Phonegap Filetransfer.download Ripple / Chrome [英] Phonegap Filetransfer.download Ripple/Chrome

查看:197
本文介绍了Phonegap Filetransfer.download Ripple / Chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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


plist文件也有一个访问*,我添加了< feature name =http://api.phonegap.com/1.0/file/> 到我的配置.xml



我试图下载一些带有以下代码的图片:

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

function download(url,filename){

//writeLog (window.appRootDir.fullPath);
ft = new FileTransfer();
ft.download(
url,
window.appRootDir.fullPath +/+ filename,
{},
{});
}

在模拟器上工作正常,但在chrome它失败,并显示以下错误:

  TypeError 
ripple.js:477
TypeError:无法调用未定义
的方法下载 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)
在下载时(http://localhost/~binderf/www/a4/js/index.js:194:5)
在downloadImage(http:// localhost / binderf / www / a4 / js / index.js:182:9)
在元素。< anonymous> (http://localhost/~binderf/www/a4/js/index.js:153:51)
在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)
在元素。< anonymous> (http://localhost/~binderf/www/a4/js/index.js:145:57)
在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

弹出一个对话框,显示以下消息:


FileTransfer.download


我们似乎缺少一些东西:

虽然你可以填充textarea以将一个json对象传递给你想要执行的回调函数,但是有点凉爽。



如果任何人有猜测或类似的问题,任何建议。

解决方案

div>

这是因为Ripple插件Chrome没有实现这个功能,它将在真实环境中工作(例如电话)。


I am working on a mobile app using jquerymobile/phonegap/cordova(2.0). I try to download some files from a stream (xml) and store them locally. This behavior only appears in chrome browser, which I use for debugging (with ripple).

How do I start the chrome ? Here we go :

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

I'm developing at the Mac my plist file also has also an access * and I added <feature name="http://api.phonegap.com/1.0/file"/> to my config.xml

I tried to download some pictures with following code :

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,
    {},
    {});
}

On simulator works fine but in chrome it fails with following error :

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

an dialog popped up with the message :

FileTransfer.download

We seem to be missing some stuff :(

What is kinda cool though you can fill in the textarea to pass a json object to the callback you want to execute.

I see its undefined but I can't figure out what is really my problem. If anyone has a guess or a similar problem please any suggestion.

解决方案

It's because Ripple plugin for Chrome has not implemented this feature. It will work in real environment (e.g. phone).

这篇关于Phonegap Filetransfer.download Ripple / Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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