【问题标题】:Cordova 3.4.0 : File Api GetFile Abort ErrorCordova 3.4.0:文件 Api GetFile 中止错误
【发布时间】:2014-07-28 08:11:40
【问题描述】:

最近将我的应用的 Cordova 框架升级到 3.4.0

我曾经在 iOS 应用程序的 Documents 目录中编写一个文件。 文件访问码sn-p如下所示。

var path = "/var/mobile/Applications/MyApp/Documents/tempDir/txtFile.txt";
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, 
            function(fileSystem){

                fileSystem.root.getFile(path,{create:true, exclusive: false},
                        function(fileEntry){
                            console.log('gotFileEntry');

                                );
                        },
                        function(){
                            console.log('gotFileEntry fail');
                            }
                        );

            }, 
            function(){
                console.log('fail');
                }
            );

在较新版本的 cordova(3.4.0) 中,它无法获取文件条目并抛出错误代码 = 3,即 ABORT_ERR

请帮助我。因为我的完整模块依赖于此。 任何帮助是极大的赞赏。提前致谢。

【问题讨论】:

  • 我猜测当前版本不允许您访问任意路径。您只需指定文件名。尝试仅指定文件名“txtFile.txt”而不是整个路径。
  • @frank :感谢您的回复

标签: javascript ios file cordova


【解决方案1】:

在挖掘Cordova FILE插件后,发现传递的文件路径在最新版本中应该是相对的。参考here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-15
    相关资源
    最近更新 更多