iOS应用程序中的空白QLPreviewController [英] blank QLPreviewController in iOS application

查看:137
本文介绍了iOS应用程序中的空白QLPreviewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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).

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

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];

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

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 是一个NSArray包含文档的fileURL。传递给 UIDocumentInteractionController 的相同fileURL正确显示。我不一定要使用QuickLook,我可能只是依赖于UIDocumentInteractionController,但事实上它不起作用真的很烦人。

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.

提前谢谢你

Giovanni

推荐答案

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

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

我报告了此类的错误(传递nil URL以获取加载指示符)在2周内得到修复。

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

这篇关于iOS应用程序中的空白QLPreviewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆