1. <i id='Bn6jy'><tr id='Bn6jy'><dt id='Bn6jy'><q id='Bn6jy'><span id='Bn6jy'><b id='Bn6jy'><form id='Bn6jy'><ins id='Bn6jy'></ins><ul id='Bn6jy'></ul><sub id='Bn6jy'></sub></form><legend id='Bn6jy'></legend><bdo id='Bn6jy'><pre id='Bn6jy'><center id='Bn6jy'></center></pre></bdo></b><th id='Bn6jy'></th></span></q></dt></tr></i><div id='Bn6jy'><tfoot id='Bn6jy'></tfoot><dl id='Bn6jy'><fieldset id='Bn6jy'></fieldset></dl></div>
      <tfoot id='Bn6jy'></tfoot>
      • <bdo id='Bn6jy'></bdo><ul id='Bn6jy'></ul>

      <small id='Bn6jy'></small><noframes id='Bn6jy'>

    2. <legend id='Bn6jy'><style id='Bn6jy'><dir id='Bn6jy'><q id='Bn6jy'></q></dir></style></legend>

        将本地 PDF 文件加载到 WebView

        Loading Local PDF File Into WebView(将本地 PDF 文件加载到 WebView)
        <tfoot id='nIILP'></tfoot>
          <legend id='nIILP'><style id='nIILP'><dir id='nIILP'><q id='nIILP'></q></dir></style></legend>

                <tbody id='nIILP'></tbody>
            • <small id='nIILP'></small><noframes id='nIILP'>

                  <bdo id='nIILP'></bdo><ul id='nIILP'></ul>

                • <i id='nIILP'><tr id='nIILP'><dt id='nIILP'><q id='nIILP'><span id='nIILP'><b id='nIILP'><form id='nIILP'><ins id='nIILP'></ins><ul id='nIILP'></ul><sub id='nIILP'></sub></form><legend id='nIILP'></legend><bdo id='nIILP'><pre id='nIILP'><center id='nIILP'></center></pre></bdo></b><th id='nIILP'></th></span></q></dt></tr></i><div id='nIILP'><tfoot id='nIILP'></tfoot><dl id='nIILP'><fieldset id='nIILP'></fieldset></dl></div>

                  本文介绍了将本地 PDF 文件加载到 WebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试将以下功能放入我正在编写的 iOS 应用程序中:

                  I am attempting to put the following functionality into an iOS app I am writing:

                  • 在 XCode 中项目的资源文件夹中发送一组 PDF
                  • 将 PDF 复制到应用目录
                  • 在网络视图中打开 PDF.

                  据我所知,前两个步骤工作正常(复制操作后我使用 FileManager 检查 fileExistsAtPath).但是,webview 是空的,并且出错(请求的 URL 在服务器上不存在").我的文件打开代码如下:

                  As far as I can see, the first two steps work ok (I've used FileManager to check fileExistsAtPath after the copy operation). However, the webview is empty, and is erroring out ("the requested URL does not exist on server"). My code for the file open is as follows:

                  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
                                                                            NSUserDomainMask, YES);
                  NSString *localDocumentsDirectory = [paths objectAtIndex:0];
                  NSString *pdfFileName = @"example.pdf";
                  NSString *localDocumentsDirectoryPdfFilePath = [localDocumentsDirectory  
                                                       stringByAppendingPathComponent:pdfFileName];
                  pdfUrl = [NSURL fileURLWithPath:localDocumentsDirectoryPdfFilePath];
                  [webView loadRequest:[NSURLRequestWithURL:pdfUrl];
                  

                  这在模拟器上运行良好,但在设备上不起作用

                  This works fine on the simulator, but doesn't work on the device

                  推荐答案

                  正如上面 Anna Karenina 所说,设备区分大小写.确保文件名完全匹配"

                  As posted by Anna Karenina above, "The device is case-sensitive. Make sure the filename matches exactly"

                  这篇关于将本地 PDF 文件加载到 WebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                  Resume game cocos2d(恢复游戏 cocos2d)
                  Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)
                  [ios.cocos2d+box2d]how to disable auto-rotation?([ios.cocos2d+box2d]如何禁用自动旋转?)
                  Storing and reading files from Documents directory iOS 5(从 Documents 目录存储和读取文件 iOS 5)
                  How can I implement a virtual joystick for a cocos2d game outside the cocos2d environment?(如何在 cocos2d 环境之外实现 cocos2d 游戏的虚拟摇杆?)
                      1. <i id='eNVw8'><tr id='eNVw8'><dt id='eNVw8'><q id='eNVw8'><span id='eNVw8'><b id='eNVw8'><form id='eNVw8'><ins id='eNVw8'></ins><ul id='eNVw8'></ul><sub id='eNVw8'></sub></form><legend id='eNVw8'></legend><bdo id='eNVw8'><pre id='eNVw8'><center id='eNVw8'></center></pre></bdo></b><th id='eNVw8'></th></span></q></dt></tr></i><div id='eNVw8'><tfoot id='eNVw8'></tfoot><dl id='eNVw8'><fieldset id='eNVw8'></fieldset></dl></div>
                          <tbody id='eNVw8'></tbody>
                            <bdo id='eNVw8'></bdo><ul id='eNVw8'></ul>

                          • <legend id='eNVw8'><style id='eNVw8'><dir id='eNVw8'><q id='eNVw8'></q></dir></style></legend>
                          • <tfoot id='eNVw8'></tfoot>

                            <small id='eNVw8'></small><noframes id='eNVw8'>