Phonegap 2.2.0 iOS filetransfererror代码2

时间:2013-04-12 08:14:42

标签: ios xcode html5 cordova

saricsarda2[326:15b03] Multi-tasking -> Device: YES, App: YES
saricsarda2[326:15b03] -[CDVFileTransfer download:] [Line 313] File Transfer downloading file...
saricsarda2[326:15b03] File Transfer Finished with response code 200
saricsarda2[326:15b03] -[CDVFileTransferDelegate connectionDidFinishLoading:] [Line 437] Write file file:///Users/Pannako/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/954E4293-9125-43B0-91F4-811C51291CCC/saricsarda2.app/www/data.json
saricsarda2[326:15b03] FileTransferError {
    code = 2;
    "http_status" = 200;
    source = "http://gastromania.hu/images/restaurants/214/mobile/data.json";
    target = "file:///Users/Pannako/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/954E4293-9125-43B0-91F4-811C51291CCC/saricsarda2.app/www/data.json";
}
saricsarda2[326:15b03] [LOG] Phonegap - download error source http://gastromania.hu/images/restaurants/214/mobile/data.json
saricsarda2[326:15b03] [LOG] Phonegap - download error target file:///Users/Pannako/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/954E4293-9125-43B0-91F4-811C51291CCC/saricsarda2.app/www/data.json
saricsarda2[326:15b03] [LOG] Phonegap - upload error code2

这有什么问题?我试图在互联网上找到一些信息,我找不到任何东西。

1 个答案:

答案 0 :(得分:2)

在这一行:

target = "file:///Users/Pannako/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/954E4293-9125-43B0-91F4-811C51291CCC/saricsarda2.app/www/data.json";

您正试图在应用程序文件夹中写入并且不允许这样做,而是应该将信息保存到de Documents文件夹中,在this other question中您可以看到如何获取对它的引用,然后更改:

file:///Users/Pannako/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/954E4293-9125-43B0-91F4-811C51291CCC/saricsarda2.app

带有Documents目录的路径