我試過了所有我能想到的東西,它仍然響應NO,而Apple沒有任何提示。UIDocumentInteractionController presentPreviewAnimated:返回NO並且不顯示預覽
- (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;
}
您是否檢查tempUrl是否不爲空? – Adriana