cocoa-touch - UIDocumentInteractionController presentOpenInMenuFromBarButtonItem 在 iOS8.1 上停止工作

标签 cocoa-touch ios8

我的应用程序有一个文档交互 Controller ,用于在其他应用程序中打开文档。
以下代码显示一个按钮,该按钮可打开“打开方式”菜单并允许用户在其他应用程序中打开文件 - 即如果用户在“打开方式”菜单中选择了邮件应用程序,则通过邮件发送,邮件应用程序会创建新电子邮件并自动将文件附加到邮件正文。

以下代码在 iOS7 中运行良好,但在 iOS8+ 上无法正常运行。文件未附加到邮件,我收到一条错误日志消息。

UIDocumentInteractionController 声明:

@property (nonatomic, strong) UIDocumentInteractionController* interactionController;

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

“打开方式”菜单的调用:
[self.interactionController presentOpenInMenuFromBarButtonItem:self.openInBarButtonItem animated:YES];

打开 excel 文件后收到的错误消息示例:

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



我将不胜感激任何解决此问题的想法。

谢谢,
织里

最佳答案

这是我的代码

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

关于cocoa-touch - UIDocumentInteractionController presentOpenInMenuFromBarButtonItem 在 iOS8.1 上停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26862347/

相关文章:

objective-c - UITableView 数据源问题。当 UITableView :cellForRowAtIndexPath: is called 时,我的数据数组突然为空

iphone - iOS 设备因未知原因崩溃

iphone - 如何将图像保存到 iPhone 中的照片而不损失质量?

ios - Objective-C 生成位于给定 cgrect 中的随机点

xcode - 在允许非模块化包含设置为 YES 的框架模块中包含非模块化 header

ios - 类设计困境——相当接近的特性的重复代码

ios - 启用 iAd 的应用未收到任何请求

ios - 滚动后Xcode UISlider被添加到另一个单元格

ios8 - iOS 8.0 Beta未知UIKit日志

带有 dismissViewControllerAnimated 的 iOS 8 错误 : completion: animation?