gpt4 book ai didi

cordova - Phonegap Filetransfer.download Ripple/Chrome

转载 作者:行者123 更新时间:2023-12-04 11:09:38 26 4
gpt4 key购买 nike

我正在使用 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,
{},
{});
}

在模拟器上工作正常,但在 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

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

FileTransfer.download



我们似乎错过了一些东西:(

虽然您可以填写 textarea 以将 json 对象传递给您要执行的回调,但还是有点酷。

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

最佳答案

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

关于cordova - Phonegap Filetransfer.download Ripple/Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13990816/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com