Hello,
We are using UIActivityViewController to share a URL and text from our application. We use the completion block as defined below to detect whether the activity successfully completed or not.
UIActivityViewController *shareActivity = [[UIActivityViewController alloc] initWithActivityItems:@[ textActivity, urlActivity ] applicationActivities:nil];
[shareActivity setCompletionWithItemsHandler:^(UIActivityType __nullable activityType, BOOL completed, NSArray *__nullable returnedItems, NSError *__nullable activityError) {
if (activityError) {
// show an alert
return;
}
if (completed && activityType) {
// track the activity type
// show an alert
}
}];
As shown in the above code, we show an alert so that the user understands that the activity is completed. We also track the activity that was done. The above code works perfectly fine for posting to applications like Twitter, Facebook, Mail, Message, Notes, Slack etc. But for some activities mentioned below it fails because the completed flag comes as "true" even though the user has cancelled the activity:
Failing Activities:
- Reminders (iOS stock application)
- Outlook mail application
There might be more applications which might be failing but I was able to find above applications since I have them installed on my device.
Is there anyway to fix this problem?
Regards,
Bhavik