Phonegap App failing on iOS11

I have an app that’s been on the Google and Apple stores for about 2 years now but it has stopped working with iOS 11. It fails to load properly, leaving some design-time text on the screen that should be replaced, and generates an error related to history.pushstate whenever a button is pressed. I’ve tried to upload a version onto a test device from a Mac but that simply reports that it couldn’t be installed. Installing from the App Store appears to work but the splash screen fails to display (just the phonegap icon) and although the Pushwoosh authorisation appears to work ok, nothing else does.

On Android and earlier versions of iOS it worked and still works exactly as expected. The app is built using PhoneGap Build/CLI 6.50 so it should definitely be 64 bit. The web app version also runs on iOS11 as expected.

Not being able to even load it onto a test device rather restricts my options so I’m hoping someone might be able to suggest where to look?

Thanks

First step is to fix the loading onto a test device, so you can experiment with solutions.

You will need to dig into Apple’s docs on provisioning test devices.

The device I’ve tried to load it onto has been set up under our Apple Developer account, and it gets as far as the icon appearing when I try to transfer the app to it. The progress bar goes round as expected but then the icon goes black and touching it brings up the message ‘Could not install’.

As such I don’t think it’s a problem with the setup that’s stopping me installing it, rather with the app itself.

I am having similar problems on iOS11. The phonegap app works fine on Android (including a working splash screen), but on iOS11, loading a simple .json file into a listgroup now fails (empty listgroups) on iOS11. This has been working fine on pre-iOS11 devices. Works perfectly on Android, Volt and Desktop.

Not sure in my case if it is matter of a new ‘Content Security Policy’ requirement on iOS11 or not. The path to the json is simply xmlhttp.open(“GET”,“js/myfile.json”,true), relative to the index.html file, also in the manifest, etc… Nothing has changed there. Not sure how to fix this for iOS11.

Also, trying to deploy to a registered test device via iTunes, now getting the dark icon and ‘Could not install’ error as well.

Thanks Johnny. I notice there’s a related thread [here] recently started suggesting that other aspects aren’t working in iOS11 because the iOS11 SDK wasn’t used.

What version of PhoneGap Build are you using? (This information shows up on https://build.phonegap.com/apps)

As stated in the original post it’s CLI 6.50

Try putting this into contentSecurityPolicy in Project Properties:

default-src * gap://ready file:; style-src 'self' 'unsafe-inline' *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *

I ran a test project here. I was able to build for iOS and install OK, but got a white screen. Hooking up Safari in debug mode let me see that there were errors in the CSP. Looks like PhoneGaps’s requirements for this have changed.

I added that line and tried to build but Phonegap Build seems to have gone mad in the interim. I now get build failures on both iOS and Android. The iOS reports that the pushwoosh plugin is out of date and the Android seems to be objecting to my Java version, which hasn’t altered since I last compiled the apk last week. This is the case with or without the CSP line included.

Furthermore, adding that line to the CSP means that in the web app icons don’t appear on any buttons and my Google Maps page fails to load.

PhoneGap Build is a moving target - it’s normal that things change over time. It has a huge number of dependancies, any of which are likely to be updated at any time.

You will have to work through the issues one at a time.

Here are PhoneGap’s docs on the CSP:

It seems to be out of date already, but not having the latest form of gap://ready.

So it appears that the pushwoosh plugin is at fault. I’ve removed all reference to it and both versions now compile on Phonegap Build.

However, with the following contentSecurityPolicy;

default-src * gap://ready file:; style-src ‘self’ ‘unsafe-inline’ *; script-src ‘self’ https://maps.googleapis.com https://maps.gstatic.com ‘unsafe-inline’ ‘unsafe-eval’

It still won’t install on an iPhone.

I’ve specified an earlier version of the pushwoosh plugin (7.0.6) and that seems to work too. Still no joy on the iOS though.

Hello, I am running into this same with our app. It has been working fine, and currently works in Android, but not IOS after upgrading to IOS 11.1 and 11.2.

I have tried updating the content security policy like above, but still get the “DOM exception 18: blocked attempt to use history.pushstate()” in IOS.

I am not clear what all to change in the content security policy property? I have many more lines in addition to this line

In my project folders I have a www folder index.html file I also see <meta http-equivv-'Content-security-policy tag’
is this the same as what is in the content security property of the global code in appstudio?

Is there more than one place to make this content security policy change?

Thank you,
Mark

What do you have enableBrowserArrows in Project Properties set to?

EnableBrowserArrows is set to True

Thank you,
Mark

If you’re not using them, try turning this off.

That seems to have done the trick, thanks. Now to see what Apple make of it!

Guess what? Can’t upload it as Application Loader reports that it can’t find the icons. They are of course exactly where they should be in the icons folder. I wondered if this might be because the content security policy doesn’t specify any image source? However, I tried removing the entire CSP string and the app still loads on an iPhone in development mode so I uploaded that version, still get the same issue.

After updating the CSP to what was listed above and setting the enableBrowserArrow to false, we can build our app once again to ios 11.2 device wihout getting the the “DOM exception 18: blocked attempt to use history.pushstate()” in IOS.

Thank you for your help!

Thank you,
Mark

Turns out there were issues at Phonegap Build. In the end I had to upgrade to build version 7.0.1 and change the references to gap:slash to remove the gap: element.