开发者

Loading PDF file from Resource directory in iPhone crashes

开发者 https://www.devze.com 2023-01-22 00:22 出处:网络
NSURL *pdfURL = [[NSBundle mainBu开发者_JAVA技巧ndle] URLForResource:@\"sampleLayout.pdf\" withExtension:nil];
NSURL *pdfURL = [[NSBundle mainBu开发者_JAVA技巧ndle] URLForResource:@"sampleLayout.pdf" withExtension:nil];

This above line warns NSBundle may not respond to -URLForResource:withExtension: and the app crashes while loading the PDF file from this URL path.


Why dont you try like this..?

NSString *urlPath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"pdf"];
NSURL *url = [NSURL fileURLWithPath:urlPath];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[webViewOutlet loadRequest:urlRequest];


NSURL *pdfPath = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"test" ofType:@"pdf"]];

i got working from this above line, i think this is alternative for ipad 3.2 from iphone 4.0 os

0

精彩评论

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