Cordova / Phonegap:在后台线程中运行FileTransfer插件
我看到了一个未解决的问题:在后台主题中执行PhoneGap FileTransfer?
I saw an old unsolved question: Run PhoneGap FileTransfer in background thread?
有关此主题的任何消息吗?
Is there any news regarding this topic?
我使用Cordova 3.4.0 with FileTransfer插件并且当我下载一个文件UI UI开始滞后expiant在装载gif一直冻结的iOS设备
I'm using Cordova 3.4.0 with FileTransfer plugin and when i download a file the UI starts to lag expecially on iOS devices where the loading gif is freezed for all the time
是否有平滑下载文件的替代插件?
Is there any alternative plugin for download files smoothly?
我刚刚检查了文件传输的发行说明。此问题已在最新版本中修复:
I just checked the release notes for file-transfer. The issue has been fixed in the latest build:
0.4.3(2014年4月17日)
0.4.3 (Apr 17, 2014)
... CB-5175:[ios] CDVFileTransfer异步下载(修复#24)
...
... CB-5175: [ios] CDVFileTransfer asynchronous download (Fixes #24) ...
$ b b
不幸的是,这个构建完全打破了文件传输下载,不调用success或fail回调。请参阅 https://issues.apache.org/jira/browse/CB-6720?focusedCommentId=14008776&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14008776 。
我手动修补了CDVFileTransfer.m以包含最新版本的后台线程代码。在下载方法中,您需要替换
I manually patched CDVFileTransfer.m to include the background thread code from the latest version. In the download method you need to replace
[delegate.connection start];
// Downloads can take time
// sending this to a new thread calling the download_async method
dispatch_async(
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL),
^(void) { [delegate.connection start];}
对我来说,但显然你是自己的,直到科尔多瓦发布正式的解决方案。
So far this has been working reliably for me, but obviously you're on your own until Cordova releases an official fix.