iOS应用程序中的空白QLPreviewController

mag*_*gix 8 ios qlpreviewcontroller

我正在尝试使用QLPreviewController显示文件.QL视图正确显示(被推送到我的导航控制器顶部)但内容为空白.但是,不会显示任何错误,应用程序也不会崩溃.检查文件是否存在返回true.(一个证据是,如果我使用[self.docInteractionController presentPreviewAnimated:YES];docInteractionController UIDocumentInteractionController是正确显示的文件).

代码直接取自Apple示例代码DocInteraction.

previewController.dataSource = self;
previewController.delegate = self;
// start previewing the document at the current section index
previewController.currentPreviewItemIndex = 0; //I want the first (and only) document
[[self navigationController] pushViewController:previewController animated:YES];
[previewController release];
Run Code Online (Sandbox Code Playgroud)

当前视图是a QLPreviewControllerDataSource, QLPreviewControllerDelegate,,委托方法如下:

- (NSInteger) numberOfPreviewItemsInPreviewController: (QLPreviewController *) controller 
{
return self.documentURLs.count;
}

- (id)previewController:(QLPreviewController *)previewController previewItemAtIndex:    (NSInteger)index
{
return [self.documentURLs objectAtIndex:index];
}
Run Code Online (Sandbox Code Playgroud)

documentURLs是一个包含文档的fileURL的NSArray.相同的fileURL UIDocumentInteractionController正确传递给显示器.我不一定要使用QuickLook,我可能只是依赖于UIDocumentInteractionController,但事实上它不起作用真的很烦人.

先感谢您

乔瓦尼

Coc*_*ics 0

制作一个演示该问题的示例。如果您发现它在 iOS 7 上仍然出现,请提交错误报告。

我报告了此类的一个错误(传递 nil URL 来获取加载指示器),并在 2 周内得到修复。