<legend id='8owFU'><style id='8owFU'><dir id='8owFU'><q id='8owFU'></q></dir></style></legend>
  • <small id='8owFU'></small><noframes id='8owFU'>

      <bdo id='8owFU'></bdo><ul id='8owFU'></ul>
      <tfoot id='8owFU'></tfoot>

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

      1. Ionic 3 Native:文件:{代码:5,消息:“ENCODING_ERR"}

        时间:2024-04-13

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

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

              <tfoot id='NYTQA'></tfoot>
                <tbody id='NYTQA'></tbody>
                  <bdo id='NYTQA'></bdo><ul id='NYTQA'></ul>
                  <legend id='NYTQA'><style id='NYTQA'><dir id='NYTQA'><q id='NYTQA'></q></dir></style></legend>

                • 本文介绍了Ionic 3 Native:文件:{代码:5,消息:“ENCODING_ERR"}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 Ionic 3 中使用 file API 插件中的 checkFile 函数检查本地是否存在文件.Promise 拒绝并出现以下错误:

                  I'm using the checkFile function from File API plugin in Ionic 3 to check if a file exists locally. The Promise rejects with the following error :

                  FileError {code: 5, message: "ENCODING_ERR"}

                  FileError {code: 5, message: "ENCODING_ERR"}

                  根据我在 Mozilla Docs of the File APIbaseDirectory 的值设置为 file:///data/user/0/ch.protectator.fehpedia/files/):

                  From what I see on the Mozilla Docs of the File API, the problem is that "The URL is malformed." However, I don't see how is the URL malformed. Here is the relevant code showing how I'm calling the function plus the actual values of involved variables (The value of baseDirectory is set to file:///data/user/0/ch.protectator.fehpedia/files/) :

                  let baseDirectory = this.file.dataDirectory;
                  let fileToCheck = "File:Icon Portrait Abel.png";
                  
                  let promise = this.file.checkFile(this.file.dataDirectory, fileName).then(bool => {
                      // Things
                  }, reason => {
                      console.error(reason);
                  });
                  

                  这就是失败的 Promise.这种情况的奇怪之处在于,我实际上试图稍后在代码中显示该图像,忽略 File.checkFile 是否已找到它,并且 图像显示.

                  And that's the Promise that fails. What's strange about that case is that I actually tried to display that image later in the code, ignoring if it has been found by File.checkFile, and the image displays.

                  在 HTML 模板中,我稍后使用:

                  In the HTML template, I later use :

                  <img [src]="imgUrl">
                  

                  其中 imgUrl 使用 :

                  this.imgUrl = this.file.dataDirectory + '/' + "File:Icon Portrait Abel.png";
                  

                  所以图像存在并在被 WebView 调用时正确显示,但是 Native File 插件告诉我 URL 格式错误,即使对我来说它似乎是完全相同的 URL.那就是我卡住的地方,我不知道要更改什么才能使代码正常工作.checkFile 应该以不同的方式使用吗?此外,更准确的失败原因会有所帮助,但我得到的只是 ENCODING_ERR,我不知道 URL 的哪个实际部分看起来格式不正确.

                  So the image exists and displays correctly when called by the WebView, but the Native File plugin tells me the URL is malformed, even to me it seems to be exactly the same URL. That's where I'm stuck, I don't know what to change for the code to work. Should checkFile be used in a different way ? Also, a more precise cause of failure would help, but all I got is ENCODING_ERR, I don't know what actual part of the URL seems malformed.

                  推荐答案

                  在查看了类似的案例后,我没有找到关于这个特定案例的解决方案或文档.但是在尝试不同的值时,我发现了导致此错误的原因::.是的,结肠.文件名中的那个.

                  After looking through similar cases, I've found no solution nor documentation about this specific case. But while experimenting with different values, I found what caused this error : :. Yes, the colon. The one present in the file name.

                  虽然我仍然无法解释 为什么 : 导致本机 File 插件失败但不是 web 视图,删除 : 从文件名有效地允许 File 看到它而无需引发 ENCODING_ERR.虽然这不是最佳解决方案,但此解决方法是有效的.

                  While I still have no explanation about why : causes the native File plugin to fail but not the web view, removing : from the file name effectively allows File to see it without raising an ENCODING_ERR. While this is not an optimal solution, this workaround is effective.

                  这篇关于Ionic 3 Native:文件:{代码:5,消息:“ENCODING_ERR"}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:firebase 社交登录未重定向到应用程序,离子 3,ios 下一篇:Ionic 3:从 PlayStore 链接中获取价值

                  相关文章

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

                  1. <tfoot id='4b38p'></tfoot>

                    1. <small id='4b38p'></small><noframes id='4b38p'>

                      • <bdo id='4b38p'></bdo><ul id='4b38p'></ul>