我最近将我的 iOS Cordova 项目从 2.7.0 升级到了 3.4.0。
升级后文件系统访问被破坏。(似乎在模拟器中工作?)
我收到一条错误消息,指出“无法创建目标文件”,我四处搜索并想将“完整路径”更改为“toURL()”,但无济于事。我真的不知道接下来该尝试什么?
这是我的下载代码
window.requestFileSystem(
LocalFileSystem.PERSISTENT, 0,
function onFileSystemSuccess(fileSystem) {
fileSystem.root.getFile(
"dummy.html", {
create: true,
exclusive: false
},
function gotFileEntry(fileEntry) {
var sPath = fileEntry.toURL().replace("dummy.html", "");
var fileTransfer = new FileTransfer();
fileEntry.remove();
fileTransfer.download(
"https://dl.dropbox.com/u/13253550/db02.xml",
sPath + "database.xml",
function (theFile) {
console.log("download complete: " + theFile.toURI());
showLink(theFile.toURI());
setTimeout(function () {
checkConnection();
}, 50);
},
function (error) {
console.log("download error source " + error.source);
console.log("download error target " + error.target);
console.log("upload error code: " + error.code);
});
},
fail);
},
fail);