开发者

webview loading pdf broken in ios5

开发者 https://www.devze.com 2023-04-13 04:53 出处:网络
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 PDF

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号