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

耗尽温柔 提交于 2019-12-18 05:18:22

问题


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".


回答1:


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



来源:https://stackoverflow.com/questions/21017017/uiactivityviewcontroller-completionhandler-how-to-check-if-activity-send-or-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!