UIMailActivity doesn't call -[UIActivity activityDidFinish:] when programmatically dismissed
| Originator: | davidz | ||
| Number: | rdar://21664038 | Date Originated: | 2015-07-02 |
| Status: | Open | Resolved: | |
| Product: | iOS | Product Version: | 8.4 |
| Classification: | Reproducible: | Always |
Summary:
When MFMailComposeViewController is presented by a UIActivityViewController then dismissed using dismissViewControllerAnimated:completion:, neither -[UIActivity activityDidFinish:] nor UIActivityViewController's completion block gets called, and there is no way to do so after dismissing it because there is no way to get a handle to the UIMailActivity.
Steps to Reproduce:
Execute this code in a view controller. When the share sheet appears, choose Mail to open the email composer.
- (IBAction)foo
{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self dismissViewControllerAnimated:YES completion:nil];
});
UIActivityViewController *c = [[UIActivityViewController alloc] initWithActivityItems:@[ @"foo" ] applicationActivities:nil];
c.completionWithItemsHandler = ^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) {
NSLog(@"completion");
};
[self presentViewController:c animated:YES completion:nil];
}
Expected Results:
After 5 seconds, the mail composer is programmatically dismissed. -[UIActivity activityDidFinish:NO] is called, and the completion handler is executed.
Actual Results:
After 5 seconds, the mail composer is programmatically dismissed. -[UIActivity activityDidFinish:NO] is not called, and the completion handler is not executed.
Version:
Tested on iOS 7.1.1, iOS 8.1, iOS 8.4
Notes:
This is probably reproducible on any iOS >= 6.0.
Configuration:
Tested on iPhone 4S, 5 devices and 5S simulator
Attachments:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!