我正在使用 Phonegap[cordova 1.7.0] 通过 Xcode[ios5] 下载文件。这是我用来下载文件的代码:
function downloadfile(){
var fileTransfer = new FileTransfer();
console.log('the type of root is:');
fileTransfer.download(
"http://184.172.195.202:90/ElmNoor/Documents/1.txt",
persistent_root.fullPath,
function(entry) {
alert("I'm Downloading");
console.log("download complete: " + entry.fullPath);
},
function(error) {
alert("I'm not downloading");
console.log("download error source " + error.source);
console.log("download error target " + error.target);
console.log("upload error code " + error.code);
}
);}
但我得到错误代码 2 & 我不知道我能解决它吗?
这是我的日志:
HelloPhoneGap[933:13403] File Transfer Finished with response code 200
HelloPhoneGap[933:13403] [INFO] download error source http://184.172.195.202:90/ElmNoor/Documents/1.txt
HelloPhoneGap[933:13403] [INFO] download error target /Users/weekend/Library/Application Support/iPhone Simulator/5.1/Applications/A7883F4B-7678- 4424-A93A-77747297A11E/Documents
HelloPhoneGap[933:13403] [INFO] upload error code 2
我更改了网址,但它给出了同样的错误。你知道出了什么问题吗?
PS:我知道问题并在下面添加了答案=)
谢谢。