【问题标题】:Downloading pdf is not working无法下载pdf
【发布时间】:2013-05-17 08:34:29
【问题描述】:

我正在尝试使用下面提到的代码在本地下载我的 UIWebView 上的 PDF。

Save PDF which is displayed by UIWebView locally

当我输入NSLog(@"pdfille==%@", pdfFile); 时,我看到输出为pdfille==(null)。

知道为什么文件没有保存吗?

是因为我是在模拟器上而不是在 iPad 上运行 iOS 程序吗?

【问题讨论】:

  • 您将它存储在缓存中这可能是尝试将文件保存在文档目录中然后检查它的原因。

标签: ios objective-c ios6 uiwebview download


【解决方案1】:
NSString *filePath = [cachePath stringByAppendingPathComponent:@"someName.pdf"]

PDF 将在此路径中记录路径并使用 Finder>Go >Go to folder

【讨论】:

    【解决方案2】:

    我使用了委托方法。

    - (BOOL)webView:(UIWebView *)webview 
    shouldStartLoadWithRequest:(NSURLRequest *)request 
    navigationType:(UIWebViewNavigationType)navigationType {
    
        NSString *myURL = request.URL.absoluteString;
        NSLog(@"here I get proper URL %@", myURL);    
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-28
      • 1970-01-01
      • 2014-02-26
      • 2015-10-06
      • 2017-09-21
      • 2018-04-16
      相关资源
      最近更新 更多