gpt4 book ai didi

ios8 - UIDocumentInteractionController 在 iOS 8 中损坏

转载 作者:行者123 更新时间:2023-12-01 14:12:25 25 4
gpt4 key购买 nike

下面的相关代码在我为 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];

}

最佳答案

我一直在尝试使用 UIDocumentInteractionController 和 Delegate 尝试解决类似的问题, Controller 可以正常打开,但是选择一个应用程序会导致它在不执行任何操作的情况下关闭,我的委托(delegate)方法 documentInteractionControllerDidDismissOpenInMenu 之后也运行正常。

在控制台中我收到通知 enabledRemoteNotificationTypes is not supported in iOS 8.0 and later.

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

documentInteractionControllerDidDismissOpenInMenu
documentInteractionControllerDidDismissOptionsMenu

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

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

解决方案:

我替换了 documentInteractionControllerDidDismissOpenInMenu使用 didEndSendingToApplication它解决了我的问题。

关于ios8 - UIDocumentInteractionController 在 iOS 8 中损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26564184/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com