10

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
Community
  • 1
  • 1
chriszumberge
  • 844
  • 2
  • 18
  • 33
  • Same issue. Solutions proposed in http://stackoverflow.com/questions/25192313/sharing-via-uiactivityviewcontroller-to-twitter-facebook-etc-causing-crash did not work (sourceView or sourceRect). – loretoparisi Sep 25 '14 at 09:13

3 Answers3

5

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)

Eric
  • 3,301
  • 4
  • 33
  • 39
2

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.

arinmorf
  • 1,374
  • 16
  • 27
  • I'm seeing the same issue. Also, upon canceling out of the menu options, my action button doesn't seem to be enabled. Not sure if it has got to do with these errors. Can somebody please answer this? – Shwethascar Dec 04 '14 at 21:48
0

This is what worked for me. No errors. I had to get rid of the if statement that called "isAvailableForServiceType:". Hope it works for you!

   SLComposeViewController *tweetSheet = [SLComposeViewController
                                           composeViewControllerForServiceType:SLServiceTypeTwitter];

    [tweetSheet setInitialText:@"Great fun to learn iOS programming at appcoda.com!"];
    [self presentViewController:tweetSheet animated:YES completion:nil];

    if ([tweetSheet respondsToSelector:@selector(popoverPresentationController)])
    {
        // iOS 8+
        UIPopoverPresentationController *presentationController = [tweetSheet popoverPresentationController];

        presentationController.sourceView = sender; // if button or change to self.view.
    }
rjm226
  • 1,203
  • 1
  • 11
  • 21
  • how about `UIDocumentInteractionController` ? `UIDocumentInteractionController` don't have `popoverPresentationController` attribute – TomSawyer Nov 07 '14 at 18:04