I have installed the latest version of phonegap via npm, and have recently updated my iPhone SE to iOS 10. Now, when I run "phonegap run ios" when my device is connected via a USB cable to my iMac, the app loads, I get a debug alert from the app.bindEvents function, but the deviceready event is not fired. That is, however, until my app loses focus (by double tapping the home button), at which point my debug alert in onDeviceReady fires.
I assumed it was something to do with my app, so I removed all third-party plugins and all the superfluous javascript, but still the same happened. So I created a brand new app which installs the default Phonegap "Connecting to device..." page, and even that does it, even though I haven't modified it in any way. Again, when the app loses focus, I get the "Device is Ready" message.
Does anybody have any ideas why this might be happening?
This post has the resolution: Cordova app hanging during startup on iOS 10 (beta)
To quote:
It seems that iOS 10 requires additional entries in the Content-Security-Policy meta tag, namely gap://ready and file:. After adding these, my Content-Security-Policy looks like this:
<meta http-equiv="Content-Security-Policy" content="default-src * gap://ready file:; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src * 'unsafe-inline' 'unsafe-eval'">
So just change the above meta tag in your index.html file and the deviceready event fires.
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