Search code examples
ioscordovaphonegap-buildhybrid-mobile-appphonegap-desktop-app

PhoneGap iOS build weird behaviour


My phonegap iOS build works fine if I run through PhoneGap desktop and mobile apps but not working if ran independently (through xCode. Took from platform/ios folder).

One more weird issue is that, it works fine again if I do the following:

  • Open independent build in device and press home button
  • Run my app through PhoneGap desktop and mobile and press home button
  • Now, open independent app and it works just fine

Could not understand this crazy behaviour. This is not the case with Android build though.

Any help or clue is highly appreciated.


Solution

  • On iOS 10 the CSP became stricter and using * doesn't allow some things, so the plugins won't work if you don't have gap: in the Content-Security-Policy meta tag

    Change yours to <meta http-equiv="Content-Security-Policy" content="default-src gap: 'unsafe-inline'; style-src 'self' 'unsafe-inline'; media-src *" />