问题描述
我正在更新我的cordova应用程序,这是最后一次发布在1月 - 在文件插件的重大更改之前。所有在波纹(旧风格),但运行在iOS模拟器或iOS设备(iOS 7.1),我的window.requestFileSystem调用永远不会返回(既不失败也不成功)。这种行为对持久性和临时文件系统都会发生。
我猜我有一些配置问题。但是,我已经尝试了一切没有用。添加控制台消息我发现我的代码中的window.requestFileSystem调用在插件的requestFileSystem.js中调用requestFileSystem。我还发现CDVFile方法都被调用(按照这个顺序:initWithWebView,pluginInitialize,getExtraFileSystemsPreference,getAvailableFileSystems,registerExtraFileSystems(它注册library,library-nosync,documents,documents-nosync,cache,bundle,root))。
但是,requestFileSystem.js中的requestFileSystem的exec调用从不返回,并且从未执行过CDVFile中的方法。
有关可能出错的建议或者此时如何进一步调试?
证明这里遇到的问题与文件系统插件没有直接的关系。 requestFileSystem(或其他文件插件调用像getDirectory)从未返回的原因最终是cordova.exec调用永远不会返回 - 这将发生后控制台插件(org.apache.cordova.console)加载(然后任何后续的cordova.exec调用只会挂起)。删除控制台插件解决了我的问题。
为什么删除控制台插件是我不太确定的修复。但是,我有自己的logger.js可能会干扰控制台插件?希望这是一个特定于我的代码的问题。不知道为什么这只是一个问题,我在iOS而不是Android。
I am in the process of updating my cordova app which was last released in January - prior to the significant changes to the File plugin. All is working fine in ripple (old style), but when run on the iOS simulator or iOS device (iOS 7.1), my window.requestFileSystem call will never return (neither fail nor succeed). This behaviour occurs for both persistent and temporary file systems.
I am guessing I have some configuration problem. However, I have tried everything to no avail. Adding console messages I find the window.requestFileSystem call in my code does call requestFileSystem in the requestFileSystem.js of the plugin. I also find the CDVFile methods are all called (in this order: initWithWebView, pluginInitialize, getExtraFileSystemsPreference, getAvailableFileSystems, registerExtraFileSystems (which registers library, library-nosync, documents, documents-nosync, cache, bundle, root)).
However, the exec call in requestFileSystem.js to "requestFileSystem" simply never returns and doesn't ever execute the method in CDVFile. (Note that this is after a deviceready event has returned.)
Any suggestions on what might be wrong or how to debug further at this point?
Turns out the issue encountered here was not directly related to the file system plugin. The reason the requestFileSystem (or other File Plugin calls like getDirectory referred to above) were never returning was ultimately the cordova.exec call never returning - which would happen anytime AFTER the console plugin (org.apache.cordova.console) was loaded (then any subsequent cordova.exec call would just hang). Removing the console plugin fixed my issues.
Why removing the console plugin was the fix I am less certain. However, I do have my own logger.js which may be interfering somehow with the console plugin? Hopefully this is an issue specific to my code. Not sure why this was only an issue for me on iOS and not Android.
这篇关于requestFileSystem在iOS上不会返回Cordova 3.4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!