Download a PDF from the Resource Catalog for iPhone crashes

NSURL *pdfURL = [[NSBundle mainBundle] URLForResource:@"sampleLayout.pdf" withExtension:nil];

The above line warns that it NSBundlemay not respond to -URLForResource:withExtension: and the application crashes when loading a PDF file from this URL.

+3
source share
2 answers

Why aren't you trying so hard?

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

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

I got the work from this line above, I think this is an alternative to ipad 3.2 from iphone 4.0 os

0
source

Source: https://habr.com/ru/post/1771238/


All Articles