Quicklook / QLPreviewController在ios 8上显示空白页而不是pdf,但在iOS7上运行正常 [英] Quicklook/QLPreviewController shows a blank page instead of pdf on ios 8 but works fine on iOS7

查看:275
本文介绍了Quicklook / QLPreviewController在ios 8上显示空白页而不是pdf,但在iOS7上运行正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在QLPreviewController中预览pdf文件并使用以下代码。它适用于 iOS7 以及 iOS8 上的其他类型文件(JPG / PNG),但当我尝试打开 pdf 时,它会显示空白页而不是 iOS8 上的内容。奇怪的是,它仍然在标题视图中显示pdf的名称。

I am trying to preview pdf file in QLPreviewController and using the below code. It works fine on iOS7 and for other type of files (JPG/PNG) on iOS8 as well but when I try to open pdf it shows blank page instead content on iOS8. Its weird that it still shows name of pdf in title view.

代码:

QLPreviewController *previewer = [[QLPreviewController alloc] init];
previewer.dataSource = self;
previewer.currentPreviewItemIndex = 0;
[self presentViewController:previewer animated:NO completion:nil];

和QLPreviewControllerDataSource方法:

And QLPreviewControllerDataSource methods:

- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller {
    return 1;
}

- (id<QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index {
    return [NSURL fileURLWithPath:self.pdfUrl];
}


推荐答案

这实际上是一个已知问题在iOS 8 Beta 5中。

This is actually a known issue in iOS 8 Beta 5.

查看QuickLook下的网址
https://developer.apple.com/library/prerelease/ios/releasenotes/General/RN-iOSSDK-8.0/

See the URL under QuickLook https://developer.apple.com/library/prerelease/ios/releasenotes/General/RN-iOSSDK-8.0/

这篇关于Quicklook / QLPreviewController在ios 8上显示空白页而不是pdf,但在iOS7上运行正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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