Reputation: 2217
I have a WebView which loads a PDF file:
[myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL
fileURLWithPath:[[NSBundle mainBundle] pathForResource:fileName
ofType:@"pdf"]isDirectory:NO]]];
It works fine on iPhone OS 2.x but on iPhone 3.0, when I tap the PDF for scrolling, this error appears, and the app crash:
-[NSCFDictionary _absoluteLinkURL]: unrecognized selector sent to instance 0x1c0230 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFDictionary _absoluteLinkURL]: unrecognized selector sent to instance 0x1c0230'
Upvotes: 3
Views: 844
Reputation: 10296
Try this:
NSString *urlAddress = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"pdf"];
NSURL *url = [NSURL fileURLWithPath:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
Upvotes: 1
Reputation: 203
I would try putting this on a separate line:
NSString *path = [[NSBundle mainBundle] pathForResource:fileName
ofType:@"pdf"]isDirectory:NO];
and then seeing what
NSLog(@"path: %@",path);
outputs.
Just to make sure you are getting what you expect, I'm not sure of the nuances between 2.x and 3.0 in regards to these calls, it's just my 2 cents in helping you with your issue.
Upvotes: 0