0
加載文件我建立一個應用程序,允許PDF的開放,並處理這個像這樣:不能在UIDocumentInteractionController
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url sourceApplication:(NSString *)source annotation:(id)annotation
{
if (url != nil && [url isFileURL])
{
if ([[url pathExtension] isEqualToString:@"pdf"])
{
FilePreviewViewController *filePreviewController = [[FilePreviewViewController alloc] init];
[filePreviewController setURL:url];
[self.navController pushViewController:filePreviewController animated:NO];
return YES;
}
}
return NO;
}
然後在FilePreviewController.m
:
-(void) setURL:(NSURL *) URL
{
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];
[self.documentInteractionController setDelegate:self];
[self.documentInteractionController presentPreviewAnimated:NO];
}
然而,當我打開文件和視圖轉換,我得到這些消息:
Unbalanced calls to begin/end appearance transitions for <QLRemotePreviewContentController: 0x1581fe00>.
Couldn't issue file extension for path: /private/var/mobile/Containers/Data/Application/6399D00B-47A1-4F33-B34C-3F0B07B648AE/Documents/Inbox/pdf-8.pdf
而文件本身沒有噸負載。我不確定我在做什麼錯誤,因爲這在模擬器上工作正常(即PDF加載和完美顯示)。