I've already looked at related questions here and here, and I have implemented the suggested answers to no avail.
I have a UIBarButtonItem on a UIToolbar, with Connection for Send Action to btnTBAction_touch:
In the ViewController's class header I have:
@property (nonatomic, strong) UIActivityViewController *activityViewController;
The related method in the class implementation:
- (IBAction)btnTBAction_touch:(id)sender {
NSString *string = @"Some string";
NSURL *url = [[NSURL alloc] initWithString:@"http://www.google.com"];
UIImage *image = [UIImage imageNamed:@"default.png"];
self.activityViewController = [[UIActivityViewController alloc]
initWithActivityItems:@[string, url, image] applicationActivities:nil];
if ([self.activityViewController respondsToSelector:@selector(popoverPresentationController)])
{
UIPopoverPresentationController *presentationController = [self.activityViewController
popoverPresentationController];
presentationController.sourceView = sender;
}
[self presentViewController:self.activityViewController animated:YES completion:nil];
}
While running in debug mode on a physical device when I touch the button that calls the above method, I get the following in the debug console
2014-09-19 09:43:31.635 TestApp[1878:237873] LaunchServices: invalidationHandler called
2014-09-19 09:43:31.644 TestApp[1878:237814] LaunchServices: invalidationHandler called
However, unlike the related questions my app does not crash when this happens, the app continues to work fine and the UIActivityViewController is presented correctly... but I'd rather fix the bug than say it's good enough.
Additionally I have tried a few permutations of the above method using these lines:
presentationController.sourceView = self.view;
presentationController.sourceRect = self.view.frame;
None of which helped resolve the issue.
- I'm using Xcode v6.0.1
- My App's Deployment Target is 7.0 for iPhone only
- Testing on an iPhone 5s running iOS 8.0
- Code is all in Objective-C