我已经尝试了所有我能想到的方法,但它仍然响应“否”,Apple 也没有任何提示。
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSLog(@"finished!");
NSString *tempString = [NSString stringWithFormat:@"file://%@%@", NSTemporaryDirectory(), [[NSProcessInfo processInfo] globallyUniqueString]];
NSURL *tempURL = [NSURL URLWithString:tempString];
[receivedData writeToURL:tempURL atomically:YES];
NSLog(@"tempURL is written!");
UIDocumentInteractionController *interactionController = [UIDocumentInteractionController interactionControllerWithURL:tempURL];
interactionController.delegate = self;
[interactionController retain];
NSLog(@"--- %i", [interactionController presentPreviewAnimated:YES]);
NSLog(@"presented preview");
[connection release];
[receivedData release];
}
- (UIViewController*)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
NSLog(@"asdf");
UIViewController *viewController = [[[UIViewController alloc] init] autorelease];
[self.navigationController pushViewController:viewController animated:YES];
return viewController;
}
最佳答案
1) 您确信您打开的文件符合犹太洁食标准吗?如果不是,那么返回 NO 将是可以期待的事情
2) 我对您的委托(delegate)方法感到困惑。本方法很乐意自行将推送到导航 Controller 上。如果您改为使用此代码,您会更好吗? (请参阅 docs 了解基本原理。)
- (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller
{
return [self navigationController];
}
关于iphone - UIDocumentInteractionController presentPreviewAnimated : returning NO and not showing preview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7366736/