问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/23582850/requestfilesystem-never-returns-cordova-3-4-on-ios