使用phonegap build for iOS平臺,下載過程不起作用! 有人能告訴我爲什麼下面的代碼返回的錯誤信息:Phonegap iOS將文件從聯機文件下載到本地文件系統不起作用
("download error source " + error.source);
無法從網上 //下載圖像如:http://www.sushikoapp.com/img/branches/thumbs/big_sushiko-bchamoun.jpg
("upload error code" + error.code); sometimes 1 and sometimes 3
的代碼如下:
var ios_directoryEntry = fileSystem.root;
ios_directoryEntry.getDirectory("branches", { create: true, exclusive: false }, onDirectorySuccessiOS, onDirectoryFailiOS);
var ios_rootdir = fileSystem.root;
//var ios_fp = ios_rootdir.fullPath;
var ios_fp = ios_rootdir.toURL();
ios_fp = ios_fp + "branches/" ;
//ios_fp = "cdvfile://localhost/persistent/branches/";
var fileTransfer = new FileTransfer();
fileTransfer.download(encodeURI(imgURL + "branches/thumbs/big_sushiko-bchamoun.jpg"), ios_fp + "big_big_sushiko-bchamoun.jpg",
function (entry) {
alert("download complete: " + entry.fullPath);
}
},
function (error) {
//Download abort errors or download failed errors
alert("download error source " + error.source);
alert("upload error code" + error.code);
}
);
謝謝您的建議...
好吧,我們會嘗試此過程... – 2015-02-09 10:08:15
我得到的警報下面:錯誤獲取文檔目錄:5 //代碼5 – 2015-02-09 13:09:52
沒有在上下文中看到更多的代碼,很難知道是什麼導致了該錯誤。你是否在deviceready事件觸發後調用resolveLocalFileSystemURL? – DaveAlden 2015-02-09 14:10:33