ios8xcode6uiactivityviewcontrollerslcomposeviewcontroller

LaunchServices: invalidationHandler called - iOS 8 share sheet


Seeing this error message in the logs, though not consistently, around the time that I use SLComposeViewController to open a Twitter or Facebook share sheet. I am not using any new iOS 8 API, just testing existing code on iOS 8. I see others have had this problem and even seen crashes when using other modal view controllers from the Cocoa Touch SDK.

LaunchServices: invalidationHandler called

Are there new precautions to take with SLComposeViewController and UIActivityViewController in iOS 8? Something else to consider?


Solution

  • Add this code after you present your activity view controller:

    if ([activityVC respondsToSelector:@selector(popoverPresentationController)])
    {
        // iOS 8+
        UIPopoverPresentationController *presentationController = [activityVC popoverPresentationController];
    
        presentationController.sourceView = sender; // if button or change to self.view.
    }