I have a UIActivityViewController which won’t dismiss the Mail dialog on the iPad. The code is standard from an Apple example and it works fine on the iPhone.
NSString* someText = [NSString stringWithFormat:@"%@ Is really cool, sent from Element Story. en.wikipedia.info/wiki/%@",
[_detailItem description], [_detailItem description]];
ActivityViewCustomProvider *customProvider =
[[ActivityViewCustomProvider alloc]init];
NSArray *items = [NSArray arrayWithObjects:customProvider,imageView.image,someText, nil];
//ActivityViewCustomActivity *ca = [[ActivityViewCustomActivity alloc]init];
// ...or whatever pieces of data you want to share.
UIActivityViewController *activityVC =
[[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];
//applicationActivities:[NSArray arrayWithObject:ca]];
activityVC.excludedActivityTypes = @[UIActivityTypeAssignToContact, UIActivityTypePrint, UIActivityTypeCopyToPasteboard];
[self presentViewController:activityVC animated:YES completion:^{}];
I am assuming you are displaying this from a splitviewcontroller and that’s a problem I’ve run into as well. Essentially you will need to present the UIActivityViewController from the main view.
so rather than
something like:
[[[self parentViewController] parentViewController] presentViewController:activityVC animated:YES completion:nil];Unfortunately it doesn’t look quite as good because it’ll show the options throughout the entire view and not just in the context of the navigation side or the details side but it’ll work.