Rober
Rober

Reputation: 726

Ionic whitelist plugin blocks the iPhone but works in the browser

I have an ionic mobile app that communicates with a backend. It runs a simple login which works perfectly in android (browser/phone) and mac (just browser). It fails when running on iPhone returning:

 MyAppName[931:60b] ERROR whitelist rejection:

 url='https://login.myurlapi.com/apitest/validate.php'

I've checked the white-list-plugin documentation and should be find with the config added into my config.xml:

<access origin="myapiurl.com"/>
  <allow-navigation href="https://*/*"/>
  <allow-intent href="https://*/*"/>
  <preference name="webviewbounce" value="false"/>
  <preference name="UIWebViewBounce" value="false"/>
  <preference name="DisallowOverscroll" value="true"/>
  <preference name="android-minSdkVersion" value="16"/>
  <preference name="BackupWebStorage" value="none"/>
  <preference name="SplashScreen" value="screen"/>
  <preference name="SplashScreenDelay" value="3000"/>
  <feature name="StatusBar">
    <param name="ios-package" onload="true" value="CDVStatusBar"/>
  </feature>
  <platform name="ios">
    <access origin="myapiurl.com"/>
  </platform>

UPDATE: I've checked the logs and it looks like is not able to get even the default ionic style cascade sheets from:

 ERROR whitelist rejection:
 url='http://code.ionicframework.com/ionicons/1.5.2/css/ionicons.min.css'

Upvotes: 0

Views: 145

Answers (1)

Rober
Rober

Reputation: 726

this is the configuration to fix the connectivity issue in iOS and keep it working properly in android, see how I'm using config within each platform instead of using global parameters:

  <content src="index.html"/>
  ...
  <preference name="SplashScreen" value="screen"/>
  <preference name="SplashScreenDelay" value="2000"/>
  <feature name="StatusBar">
    <param name="ios-package" onload="true" value="CDVStatusBar"/>
  </feature>
  <platform name="ios">
    <access origin="myapiurl.com"/>
    <icon src="resources/ios/icon/icon.png" width="57" height="57"/>
    <icon src="resources/ios/icon/[email protected]" width="114" height="114"/>
    ... 
  </platform>
  <platform name="android">
    <access origin="myapiurl.com"/>
    <allow-navigation href="https://*/*"/>
    <allow-intent href="https://*/*"/>
    <icon src="resources\android\icon\drawable-ldpi-icon.png" density="ldpi"/>
    ...
  </platform>

Upvotes: 0

Related Questions