6

My app has a document interaction controller which is used to open documents in other apps. The following code displays a button that opens the 'Open in' menu and allows the user to open the file in other apps – i.e. Send it by mail if the user chose the mail app in the 'Open in' menu, the mail app creates a new email and automatically attaches the file to the mail body.

The following code worked fine in iOS7 but stopped working well on iOS8+. Files are not being attached to mails and I get an error log message.

Declaration for UIDocumentInteractionController:

@property (nonatomic, strong) UIDocumentInteractionController* interactionController;

Initialization:

self.interactionController = [UIDocumentInteractionController interactionControllerWithURL:self.url];
self.interactionController.delegate = self;
self.interactionController.name = self.file.name;

The call for the 'Open in' menu:

[self.interactionController presentOpenInMenuFromBarButtonItem:self.openInBarButtonItem animated:YES];

Example for error message received after opening an excel file:

Unknown activity items supplied: ( { "com.microsoft.excel.xls" = <504b0304 ....000000>; }, "" )

viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 3.)" UserInfo=0x… {Message=Service Connection Interrupted} (lldb).

I would appreciate any ideas to fix this issue.

Thanks, Ori

ori888
  • 740
  • 1
  • 8
  • 17
  • using a simulator? may be a similar issue... http://stackoverflow.com/questions/25801366/while-mail-sending-process-using-ios-8-simulators-generates-error and http://stackoverflow.com/questions/25604552/i-have-real-misunderstanding-with-mfmailcomposeviewcontroller-in-swift-ios8-in – websky Apr 10 '15 at 13:13

1 Answers1

0

Here is my Code

        BOOL IOS8=SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0");
        if (IOS8){
        if ([interactionController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES]) {
            NSLog(@"menu is presented");
        }
012346
  • 199
  • 1
  • 4
  • 23