【问题标题】:UIDocumentInteractionController broken in iOS 8UIDocumentInteractionController 在 iOS 8 中损坏
【发布时间】:2014-12-21 06:02:26
【问题描述】:

下面的相关代码在我为 iOS 7 构建时运行良好,但现在在 iOS 8 中似乎无法正常运行。

正确地说,我的意思是它实际上并没有将文件或任何内容发送到所选的应用程序。

示例:如果我选择了邮件,它将打开邮件应用程序,其中包含我在文本字段中选择的图像或 zip。现在它不会发送,调用/关闭 UIDocumentInteractionController 需要很长时间。

我做错了什么?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [self.tableView deselectRowAtIndexPath:indexPath animated:NO];

    NSString *fileName = [directoryContents objectAtIndex:indexPath.row];
    NSString *path;
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    path = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Downloads"];
    path = [path stringByAppendingPathComponent:fileName];


    documentController = [[UIDocumentInteractionController alloc] init];
    documentController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:path]];
    [documentController setDelegate:self];
    [documentController presentOptionsMenuFromRect:CGRectZero inView:self.view animated:YES];
    [documentController retain];

}

【问题讨论】:

    标签: ios8 tableview share cell


    【解决方案1】:

    我一直在玩 UIDocumentInteractionController 和 Delegate 试图解决类似的问题,控制器正常打开但选择一个应用程序导致它关闭而不做任何事情,我的委托方法 documentInteractionControllerDidDismissOpenInMenu 之后也运行正常.

    在控制台中,我收到了通知iOS 8.0 及更高版本不支持enabledRemoteNotificationTypes。

    事实证明,当调用这些委托方法之一时会出现此问题:

    documentInteractionControllerDidDismissOpenInMenu
    documentInteractionControllerDidDismissOptionsMenu
    

    (可能还有其他人,我没有检查所有这些)

    我在 IOS 开发库UIDocumentInteractionController.h 中没有找到关于 IOS 8.1 不支持的这些方法的任何评论,但目前我找不到任何其他方法解释。

    解决办法:

    我替换了documentInteractionControllerDidDismissOpenInMenudidEndSendingToApplication 它为我解决了问题。

    【讨论】:

    • 在为 iOS 7 编写代码时,我没有使用 documentInteractionControllerDidDismissOpenInMenu documentInteractionControllerDidDismissOptionsMenu,就目前而言,我还没有使用它。
    • 尝试完全删除委托,是否正在发送?您还实现了哪些其他委托方法?另外,发送失败时控制台输出中写了什么?
    • OP 中发布的内容与它相关。至于失败的时候输出的是一堆634e653a等等等等,后面是: " ) viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "操作无法完成。 (_UIViewServiceInterfaceErrorDomain 错误 3.)" UserInfo=0x7ff3f4b5d440 {Message=Service Connection Interrupted} 等待来自 com.apple.MailCompositionService 的栅栏屏障时超时
    • 你在模拟器上运行吗? MFMailComposeRemoteViewController 模拟器 8.1 崩溃尝试在实际设备上运行
    • 这是我从阅读该主题中收集到的。但是我没有要测试的 iOS 设备。打算找几个我认识的人。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-10-08
    • 2014-11-18
    • 1970-01-01
    • 1970-01-01
    • 2015-03-29
    • 1970-01-01
    • 2017-02-24
    相关资源
    最近更新 更多