Phonegap 3.4文件传输错误(iOS) [英] Phonegap 3.4 FileTransfer error (iOS)

查看:183
本文介绍了Phonegap 3.4文件传输错误(iOS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从服务器加载文件并将其保存在设备上。这段代码用于在Phonegap 3.1中工作,它仍然工作正常在Android上的3.4。但是当我在iOS 7.1上运行相同的代码。我有一个错误说,

I'm trying to load a file from a server and save it on the device. This code used to work in Phonegap 3.1, and it's still working fine with 3.4 on Android. But when I run the same code on iOS 7.1. I got an error saying,

{
    "code":1,
    "source":"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/18/96730/70400",
    "target":null,
    "http_status":200,
    "body":"Could not create target file"
}

代码。

var fileTransfer = new FileTransfer();
fileTransfer.download(encodeURI('http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/18/96730/70400'), '/com.mee.flight/maptile/70400', function (entry) {
    //Do something
});

开始我认为解决方案是直接的,因为Phonegap实际上告诉我,目标文件。所以,我搞砸了文件路径,但他们没有真正解决。任何想法?

At first I thought the solution is straight forward, since Phonegap actually tells me that there's something wrong with the target file. So, I fiddled with the file path, but they didn't really work out. Any idea?

推荐答案

我想出了这一点。如果任何人有同样的问题,解决方案是使用cdvfile:// localhost / persistent /到达Phonegap的根文件夹。所以,在我的情况下,更改将是,

I figured this out already. In case anyone's having the same problem, the solution is to use 'cdvfile://localhost/persistent/' to get to the root folder in Phonegap. So, in my case, the change would be,

var fileTransfer = new FileTransfer();
fileTransfer.download(encodeURI('http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/18/96730/70400'), 'cdvfile://localhost/persistent/com.mee.flight/maptile/70400', function (entry) {
    //Do something
});

这篇关于Phonegap 3.4文件传输错误(iOS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆