IPhone 3.0 WebView Scroll PDF Error - [NSCFDictionary _absoluteLinkURL]

I have a webview that 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 click PDF to scroll, this error appears, and the application crashes:

- [NSCFDictionary _absoluteLinkURL]: unrecognized selector sent to instance 0x1c0230 Application terminated due to an uncaught exception "NSInvalidArgumentException", reason: "- [NSCFDictionary _absoluteLinkURL]: unrecognized selector sent to instance 0x1c0230 '

+3
source share
2 answers

Try the following:

NSString *urlAddress = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"pdf"];
NSURL *url = [NSURL fileURLWithPath:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
+1
source

I would put this on a separate line:

NSString *path = [[NSBundle mainBundle] pathForResource:fileName
ofType:@"pdf"]isDirectory:NO];

,

NSLog(@"path: %@",path);

.

, , , 2.x 3.0 , 2 , .

0

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


All Articles