1
votes

I am trying to download locally the PDF that is there on my UIWebView using code mentioned below.

Save PDF which is displayed by UIWebView locally

When I type, NSLog(@"pdfille==%@", pdfFile);, I see output as pdfille==(null).

Any idea why file is not getting saved?

Is it because I am running the iOS program on Simulator and not on iPad?

2
You are storing it in cache That's may be a reason try to save file in document directory and then check it.umer sufyan

2 Answers

0
votes
NSString *filePath = [cachePath stringByAppendingPathComponent:@"someName.pdf"]

PDF will be there in this path Log the path and use Finder>Go >Go to folder

0
votes

I used delegate method.

- (BOOL)webView:(UIWebView *)webview 
shouldStartLoadWithRequest:(NSURLRequest *)request 
navigationType:(UIWebViewNavigationType)navigationType {

    NSString *myURL = request.URL.absoluteString;
    NSLog(@"here I get proper URL %@", myURL);    

}