Cordova getDirectory返回错误代码

时间:2014-02-17 11:08:19

标签: ios cordova

我正在尝试访问cordova iOS应用中的文件系统,但是当我使用getDirectory方法时,它总是返回错误代码3(ABORT_ERR)。

我正在使用以下代码:

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail);

function onFileSystemSuccess(fileSystem) {
    console.log(fileSystem.name);
    dataDir = fileSystem.root.getDirectory("ozzie", {create: true}, getDir, fail);
}

function getDir(dir) {
    console.log("successfull got directory", dir);
}

function fail(error) {
    console.log("error", error.code);
}

Wich返回fileSystem.name(“持久”),但它永远不会获取目录。这总是返回error.code = 3,根据phonegap文档是ABORT_ERR。

之前有没有人有这种行为?

1 个答案:

答案 0 :(得分:0)

也许您的问题是您尝试创建两个目录,例如:directory1/directory2

在iOS中,您应首先创建一个,然后创建另一个。

在iPad中,Documents目录不存在。