Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Present UIActivityViewController- LaunchServices:invalidationHandler called

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
like image 536
chriszumberge Avatar asked Sep 19 '14 15:09

chriszumberge


2 Answers

If your development target target device is iPhone you should not worry about this message. It looks like it's a bug from Apple. Looking at the developer forums: "That log message does not indicate any error on your part."

See: https://devforums.apple.com/message/1049415#1049415 (might require you to login)

like image 168
Eric Avatar answered Nov 15 '22 19:11

Eric


Similar issue here.

I am using UIDocumentInteractionController, not UIActivityViewController, so there is no sourceView or sourceRect to handle.

In the header:

UIDocumentInteractionController *docInteractionController;

In the .m:

self.docInteractionController = [UIDocumentInteractionController  interactionControllerWithURL:fileURL];

self.docInteractionController.delegate = self;
self.docInteractionController.UTI = @"com.adobe.pdf";
//UIBarButtonItem *element is an element in my toolbar
[self.docInteractionController presentOptionsMenuFromBarButtonItem:element animated:YES];

On the console I see the following warning:

 Unknown activity items supplied: (
    {
    "com.adobe.pdf" = <25504446 (and then what looks like the rest of the pdf I tried to open)>;
},
"<UIPrintInfo: 0x17b47ca0>"
 )
 2014-10-14 21:11:21.661 iFly[288:29569] LaunchServices: invalidationHandler called

And in my official App Store version of my app, the app crashes. When I compile and run on my iPad it just gives the warning.

I can get around the "Unknown activity items" supplied part of the warning by using presentOpenInMenuFromBarButtonItem instead of presentOptionsMenuFromBarButtonItem for the UIDocumentInteractionController call, but the "LaunchServices" warning still occurs.

iPad version 8.0.2. Xcode version 6.0.1, deployment target 6.0 (also tested with deployment target 8.0). All objective-c.

like image 37
arinmorf Avatar answered Nov 15 '22 18:11

arinmorf