UIDocumentInteractionController presentOpenInMenuFromBarButtonItem works great on iOS8.1

My application has a document interaction controller that is used to open documents in other applications. The following code displays a button that opens the "Open in" menu and allows the user to open the file in other applications - that is, "Send by mail" if the user selected a mail application in the "Open" menu, a new letter created by the mail application and automatically attaches the file to the body mail.

The following code worked fine on iOS7, but worked fine on iOS8 +. Files are not attached to emails, 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; 

Call the menu "Open in:

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

Example error message received after opening the excel file:

Unknown activity objects: ({msgstr "000000>;}," ")

viewServiceDidTerminateWithError: error Domain = _UIViewServiceInterfaceErrorDomain Code = 3 "Operation could not be completed. (Error _UIViewServiceInterfaceErrorDomain 3.)" UserInfo = 0x ... {Message = Service Connection Interrupted} (lldb).

I would be grateful for any ideas to fix this problem.

Thanks Ori

+6
source share
1 answer

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"); } 
0
source

Source: https://habr.com/ru/post/978020/


All Articles