Phonegap Filetransfer.download Ripple/Chrome

use*_*446 7 cordova

我正在使用jquerymobile/phonegap/cordova(2.0)开发移动应用程序.我尝试从流(xml)下载一些文件并在本地存储它们.此行为仅出现在chrome浏览器中,我用它进行调试(带有涟漪效应).

如何启动chrome?开始了 :

/ Applications/Google\Chrome.app/Contents/MacOS/Google\Chrome --disable-web-security --allow-file-access-from-files --allow-file-access

我在Mac上开发我的plist文件也有访问权限*我添加<feature name="http://api.phonegap.com/1.0/file"/>到我的config.xml

我尝试使用以下代码下载一些图片:

function downloadImage(url,filename,use){
if(use==="thumb") {
    filename = filename + ".png";
    download(url, filename);
}return filename; }

function download(url, filename) {

//writeLog(window.appRootDir.fullPath);
ft = new FileTransfer();
ft.download(
    url,
    window.appRootDir.fullPath + "/" + filename,
    {},
    {});
}
Run Code Online (Sandbox Code Playgroud)

在模拟器上工作正常但在chrome中它失败并出现以下错误:

TypeError
ripple.js:477
TypeError: Cannot call method 'download' of undefined
at n.exports.exec (chrome-extension://geelfhphabnejjhdalkjhgipohgpdnoc/ripple.js:477:26724)
at FileTransfer.download (http://localhost/~binderf/www/a4/cordova-2.2.0.js:2753:5)
at download (http://localhost/~binderf/www/a4/js/index.js:194:5)
at downloadImage (http://localhost/~binderf/www/a4/js/index.js:182:9)
at Element.<anonymous> (http://localhost/~binderf/www/a4/js/index.js:153:51)
at Function.p.extend.each (http://localhost/~binderf/www/a4/js/jquery-1.8.2.min.js:2:14477)
at p.fn.p.each (http://localhost/~binderf/www/a4/js/jquery-1.8.2.min.js:2:11151)
at Element.<anonymous> (http://localhost/~binderf/www/a4/js/index.js:145:57)
at Function.p.extend.each (http://localhost/~binderf/www/a4/js/jquery-1.8.2.min.js:2:14477)
at p.fn.p.each (http://localhost/~binderf/www/a4/js/jquery-1.8.2.min.js:2:11151) ripple.js:477
FileTransfer 

FileTransfer ripple.js:483
download ripple.js:483
missing exec:FileTransfer.download
Run Code Online (Sandbox Code Playgroud)

弹出一个带有消息的对话框:

FileTransfer.download

我们似乎缺少一些东西:(

虽然你可以填写textarea来将json对象传递给你想要执行的回调,但有点酷.

我看到它未定义但我无法弄清楚究竟是什么问题.如果有人有猜测或类似的问题,请任何建议.

krt*_*tek 10

这是因为Chrome的Ripple插件尚未实现此功能.它将在真实环境中工作(例如电话).

  • 非常感谢你的回答,我有点困惑......但是有意义的是,这还没有实现.是的在一个真实的环境中,它对我来说很好(也在模拟器上),它只是很好的调试.. :)所以我继续使用Xcode和模拟器...你有人有代码边缘的经验?我仍然对工作流程感到不满意.所以我尝试将它们作为最有效的设计/开发/调试方式 (2认同)