blank QLPreviewController in iOS application

帅比萌擦擦* 提交于 2019-12-10 03:10:35

问题


I am trying to display a file using QLPreviewController. The QL view displays correctly (is pushed on top of my Navigation Controller) but the content is blank. However, no errors are displayed and application doesn't crash. Checks on existence of file return true. (A proof is that if I use [self.docInteractionController presentPreviewAnimated:YES]; where docInteractionController is a UIDocumentInteractionController the file is correctly shown).

The code is taken directly from Apple sample code 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];

The current view is a QLPreviewControllerDataSource, QLPreviewControllerDelegate,, and the delegate methods are as follow:

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

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

documentURLs is a NSArray that contains the fileURLs of the documents. The same fileURL passed to the UIDocumentInteractionController displays correctly. I don't necessarily have to use QuickLook, I may just rely on UIDocumentInteractionController, however the fact that it's not working is really annoying.

Thank you in advance

Giovanni


回答1:


Make a sample that demoes the issue. If you find that it still occurs on iOS 7, pls file a bug report.

I reported a bug on this class (pass nil URL to get loading indicator) and it got fixed within 2 weeks.



来源:https://stackoverflow.com/questions/8009637/blank-qlpreviewcontroller-in-ios-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!