webview加载pdf在ios5中损坏
我有以下简单的代码来在网络视图中显示 pdf。我发现在 iOS 5 中 PDF 不会显示(显示为空白,底部有一个黑条)。我尝试了不同的 PDF,并通过在 Acrobat 中打开 PDF 来验证其是否良好。你知道 iOS5 中可能发生了什么变化吗?我也验证了路径是正确的。
在 iOS 4.3 中可以正常显示
pathToPDF = [NSString stringWithFormat:@"%@/%@",[self getDocumentsPath], [chartDic objectForKey:@"PDFName"]];
NSURL *url = [NSURL fileURLWithPath:pathToPDF];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
I have the following simple code to display a pdf in a webview. I've discovered that in iOS 5 the PDF wont display (shows up as white space with a black bar at the bottom). I have tried different PDFs and verified that the PDF is good by opening it in Acrobat. Any ideas what may have chnged in iOS5? I have also verified that the path is correct.
It displays properly in iOS 4.3
pathToPDF = [NSString stringWithFormat:@"%@/%@",[self getDocumentsPath], [chartDic objectForKey:@"PDFName"]];
NSURL *url = [NSURL fileURLWithPath:pathToPDF];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个简单的错误 - 我已经实现了 shouldLoad 方法,但忘记让它返回 YES。由于某种原因,在 iOS4 中它一定默认为 YES。
This was a simple error - I had implemented the shouldLoad method and forgot to have it return YES. For some reason in iOS4 it must have been defaulting to YES.