【发布时间】: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];
}
【问题讨论】: