Ios build prod


#1

Hello,

I build for ios with ionic cordova build ios --prod.
But occasionally when build new I got a cors issue error when making a request to the real backend.
I don’t understand why it occurs sometimes.
Here is my config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="xxx" version="xxx" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>xxx</name>
    <description>To see deep in the sea</description>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
    <platform name="windows">
        <splash src="resources/windows/SplashScreen.scale-100.png" target="SplashScreen" />
        <splash src="resources/windows/SplashScreenPhone.scale-100.png" target="SplashScreenPhone" />
    </platform>
    <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="SplashScreenDelay" value="0" />
    <preference name="FadeSplashScreen" value="false" />
    <preference name="FadeSplashScreenDuration" value="0" />
    <preference name="windows-target-version" value="10.0" />
    <preference name="SplashScreenBackgroundColor" value="0xFFFFFFFF" />
    <allow-navigation href="http://*/" />
    <allow-navigation href="http://localhost:8100" />
    <plugin name="cordova-plugin-device" spec="^1.1.4" />
    <plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
    <plugin name="cordova-plugin-statusbar" spec="^2.2.0" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
    <plugin name="cordova-sqlite-storage" spec="^2.0.4" />
    <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
</widget>

package.json

{
  "name": "XXX",
  "version": "XXX",
  "author": "XXX",
  "homepage": "XXX",
  "private": true,
  "config": {
    "ionic_webpack": "./config/webpack.config.js"
  },
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.4.6",
    "@angular/compiler": "4.4.6",
    "@angular/compiler-cli": "4.4.6",
    "@angular/core": "4.4.6",
    "@angular/forms": "4.4.6",
    "@angular/http": "4.4.6",
    "@angular/platform-browser": "4.4.6",
    "@angular/platform-browser-dynamic": "4.4.6",
    "@ionic-native/core": "4.4.2",
    "@ionic-native/splash-screen": "4.4.2",
    "@ionic-native/status-bar": "4.4.2",
    "@ionic/storage": "^2.1.3",
    "angular2-cookie": "^1.2.6",
    "cordova-browser": "^4.1.0",
    "ionic-angular": "3.9.2",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "ng2-translate": "5.0.0",
    "rxjs": "^5.5.2",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@angular/cli": "^1.5.5",
    "@ionic/app-scripts": "^3.1.2",
    "typescript": "2.4.2"
  }
}


Do I need to install a special plugin or have I wrong configured the config.xml.


#2

Have you configured CORS in your backend’s service i.e. Azure or AWS?
How can you recreate this error?


#3

The backend service I cannot change.
Sometimes when i build with ionic cordova build ios --prod I got the error on the device with Cors. When I debug on the device with Safari I see localhost/Homepage and for the time when it works no localhost is shown.
That’s why I don’t understand why for the same command not the same behaviour exists.