Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
530 views
in Technique[技术] by (71.8m points)

ios7 - UIActivityViewController completionHandler how to check if activity send or not successfully?

I want to send one string via airdrop, I want to call one function when the String is received on other device successfully. I had implemented it through UIActivityViewController and I check it via completionHandler.

Here is my scenario : Device A ->send a string To Device B If Device B receive have two option -> Accept or Decline I want to call one function on Device A when Device B will receive or Decline that message.

Below is my implementation:

UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[self.customURLContainer] applicationActivities:nil];

    activityViewController.completionHandler = ^(NSString *activityType, BOOL completed) {
        NSLog(@"completed dialog - activity: %@ - finished flag: %d", activityType, completed);

        if ( completed )
        {
            NSLog(@"completionHandler - Succeed");
        }
        else
        {
            NSLog(@"completionHandler - didn't succeed.");
            // didn't succeed.
        }

But the above function always return 0, wether string is "Sent" or "Decline" by the other device.

Is it possible to check the on Device A? Because we can see the activity on Device A if receive than "Sent" and if Decline than "Declined".

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

No, this is currently not possible. You should file a bug report with Apple requesting this though


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...