Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIDocumentInteractionController presentOptionsMenuFromBarButtonItem error in ios8- Unknown activity items supplied

Tags:

UIDocumentInteractionController presentOptionsMenuFromBarButtonItem gives me a console error in ios8 hardware (and not on 7.1 hardware or earlier):

 Unknown activity items supplied: (
    {
    "com.adobe.pdf" = ;
},
""
 )

In my official App Store version of my app, the app crashes at this point. When I compile and run on my iPad it just gives the error but does not crash.

My code:

In the .h:

UIDocumentInteractionController *docInteractionController;

In the .m:

self.docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];

self.docInteractionController.delegate = self;
//UIBarButtonItem *element is an element in my toolbar
[self.docInteractionController presentOptionsMenuFromBarButtonItem:element animated:YES];

If I do a NSLog of docInteractionController.UTI I see "com.adobe.pdf" at the console, so the UTI is being recognized properly.

I can get around the "Unknown activity items" by using presentOpenInMenuFromBarButtonItem instead of presentOptionsMenuFromBarButtonItem for the UIDocumentInteractionController call, but I want to show the user the print and email options as well, not only the external app opening options.

Tested on iPad version 8.0.2. Xcode version 6.0.1, deployment target 6.0 (also tested with deployment target 8.0). All objective-c. Running on iPad version 7.1 does not produce the error.

like image 895
arinmorf Avatar asked Oct 13 '14 18:10

arinmorf


1 Answers

See radar: http://openradar.appspot.com/radar?id=5800473659441152

  • As noted you can use presentOpenInMenu instead of presentOptionsMenu. You will loose the mail option but you can do it yourself with MFMailComposeViewController with a dedicated mail button.
  • Or use UIActivityViewController with an "Open In" activity item.
  • Or just a UIActivityViewController without an "Open In" activity item if that is enough
  • Or do presentOptionsMenu on iOS7 runtime and UIActivityViewController on iOS8+ runtime (where share extensions exist)
like image 94
Karmeye Avatar answered Oct 19 '22 00:10

Karmeye