Search code examples
iosobjective-cios6uiwebviewdownload

Downloading pdf is not working


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?


Solution

  • 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);    
    
    }