LaunchServices: invalidationHandler called - iOS 8 share sheet

Kyle Clegg picture Kyle Clegg · Sep 10, 2014 · Viewed 12.9k times · Source

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?

Answer

Ram G. picture Ram G. · Sep 18, 2014

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.
}