Search code examples
ioscordovaphonegap-buildphonegap

Adobe PhoneGap - iOS app not loading until swipe up for Control Center


I am using Adobe PhoneGap with Cordova cli-6.5.0 and Apple install in a development mode. On an iPad 2 (iOS 9.3.5) the app works correctly on launch, but on an iPhone SE and an iPhone 7 both running current iOS 10.3.2 the app will not launch until I swipe up and bring the Control Center up. Not sure if it is an iOS version issue or device issue.

Same bug occurs whether the app is in Airplane mode for offline page or online to begin the app. My guess is onDeviceReady is not responding on the iPhone test until the Control Center is brought up.

Any suggestions?


Solution

  • Since this affects only iOS 10, it sounds the issue you're encountering is related to the strict application of Content Security Policy rules to UIWebView, which was added in iOS 10. By opening the Control Centre you are placing your app in the background, then dismissing the Control Centre resumes the app, which causes the issue to go away.

    See this question and answer for a full explanation and solution, but in a nutshell make sure you have a Content-Security-Policy meta tag in your index.html and make sure it contains entries for gap: and file:, for example:

    <meta http-equiv="Content-Security-Policy" content="default-src * gap: file:; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src * 'unsafe-inline' 'unsafe-eval'">