Cordova Plugins in my iOS application only work after you open the app, close it by going back to the home screen, then reopening the app. Then a THREAD WARNING displays in the XCode log.
2014-05-14 14:00:38.062 TLEMobile[28819:60b] THREAD WARNING: ['InAppBrowser'] took '192.306885' ms. Plugin should use a background thread.
2014-05-14 14:01:18.919 TLEMobile[28819:60b] THREAD WARNING: ['Notification'] took '39.698975' ms. Plugin should use a background thread.
What is causing this? And if I really need to set all the plugins as background threads how do you set that?
I have added this param to my config.xml for ios to force the plugin to load on open but that doesn't seem to work.
<param name="onload" value="true" />
I simply do not get it. I have tried reinstalling the platform as a whole. Individually removing all the plugins and putting them back and I am still getting the same issue. Plugins will only work when the app gets backgrounded and then brought back up. Here is the code from the recent build to ios as I start the app. It appears that the plugins load as th is starts but then are not accessible.
2014-05-22 15:39:40.817 TLEMobile[5199:60b] Multi-tasking -> Device: YES, App: YES
2014-05-22 15:39:40.875 TLEMobile[5199:60b] Unlimited access to network resources
2014-05-22 15:39:41.131 TLEMobile[5199:60b] [CDVTimer][device] 0.559986ms
2014-05-22 15:39:41.136 TLEMobile[5199:60b] [CDVTimer][notification] 0.389040ms
2014-05-22 15:39:41.143 TLEMobile[5199:60b] [CDVTimer][inappbrowser] 3.835022ms
2014-05-22 15:39:41.149 TLEMobile[5199:60b] [CDVTimer][socialsharing] 1.318038ms
2014-05-22 15:39:41.153 TLEMobile[5199:60b] [CDVTimer][TotalPluginStartup] 23.202002ms
2014-05-22 15:39:41.659 TLEMobile[5199:60b] Resetting plugins due to page load.
2014-05-22 15:39:41.664 TLEMobile[5199:60b] IAB.close() called but it was already closed.
2014-05-22 15:39:45.843 TLEMobile[5199:60b] Finished load of: file:///var/mobile/Applications/220DD603-0644-4290-AE21-F9B6041D8408/TLEMobile.app/www/index.html#/tab/home
2014-05-22 15:39:54.914 TLEMobile[5199:60b] THREAD WARNING: ['Device'] took '14.032959' ms. Plugin should use a background thread.
2014-05-22 15:39:55.033 TLEMobile[5199:60b] THREAD WARNING: ['Notification'] took '100.118896' ms. Plugin should use a background thread.
2014-05-22 15:40:00.716 TLEMobile[5199:60b] THREAD WARNING: ['Notification'] took '5541.863037' ms. Plugin should use a background thread.
I had same issue. Today I've found solution for my case.
The problem was with js2native bridge. Cordova has different methods to communicate with native library (bridge mode):
In cordova.js you can find iOSExec function. For iOS (except iOS 5) bridge mode is set to IFRAME_NAV.
Previous developer made couple of mistakes when on project design phase - and one of them is that whole content is removed from when view changes. And cordova's too. So cordova gets some error loops and plugins is not working.
The solution is to force XHR bridge mode. I've inserted next code right in my deviceready callback:
cordova.exec.setJsToNativeBridgeMode(cordova.exec.jsToNativeModes.XHR_NO_PAYLOAD);
I hope this will help you. Good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With