ioscordovaionic-frameworkrestrictions

Ionic App blocked by iOS 'Specific Website Only' restriction


A user has an iOS device with restrictions set in the settings to only allow 'Specific Websites Only'. As a result, an Ionic app will show the splash screen, but not do anything after that.

Presumably, the specific local URL of the app must be entered in the settings. What would that URL be?

Edit: It's also blocked if enabling the 'Limit Adult Content' setting for websites.


Solution

  • I've had a similar issue where the app couldn't access localhost. Ionic now uses a local server (since wkwebview was introduced) to serve local files. When the device's restrictions were set to 'Specific Websites Only', the app would just show a blank white screen after the splash screen.

    Adding http://localhost to the list of allowed sites worked.

    Also, removing and adding the ios platform helped a bit. Instead of showing a blank white screen after splash it showed a message saying that the site is restricted and offers the user to allow it.

    To remove and add the ios platform: (taken from the ionic docs for wkwebview - https://ionicframework.com/docs/wkwebview/)

    Ensure Xcode is closed

    Clean install:

    rm -rf platforms
    rm -rf plugins
    

    Add the platform back

    ionic cordova platform add ios
    

    Make sure localhost is allowed:

    <allow-navigation href="http://localhost:8080/*"/>
    

    Make sure WKWebView is the default engine:

    <feature name="CDVWKWebViewEngine">
      <param name="ios-package" value="CDVWKWebViewEngine" />
    </feature>
    <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
    

    Build ionic ios

    ionic cordova build ios
    

    Open Xcode and try to build again.