问题
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.
回答1:
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.
回答2:
Are you developing the app itself and you don't know what URL it's connecting to? If this is not your app, then ask the developer what is the URL and add it to the allowed list, there's no way to find it out otherwise. The local index.html URL should not be blocked, otherwise no Cordova-based app would work with this behavior.
来源:https://stackoverflow.com/questions/50019037/ionic-app-blocked-by-ios-specific-website-only-restriction