IOS http failure after updating to 3.7


#1

Hi, after framework updating to 3.7 im trying to build ios app, but my http requests stop working. The error is:

Http failure response for (unknown url): 0 Unknown Error 

I have no idea what is the reason. Everything worked fine with the previous framework version (on android the app works fine even after framework updating to 3.7)

   @ionic/cli-utils  : 1.13.0
    ionic (Ionic CLI) : 3.13.0

global packages:

    cordova (Cordova CLI) : 7.0.1 

local packages:

    @ionic/app-scripts : 3.0.0
    Cordova Platforms  : ios 4.4.0
    Ionic Framework    : ionic-angular 3.7.1

System:

    ios-deploy : 1.9.2 
    ios-sim    : 5.0.13 
    Node       : v6.10.0
    npm        : 3.10.10 
    OS         : macOS Sierra
    Xcode      : Xcode 9.0 Build version 9A235 

#2

Did you remote debug the problem on the device already? Follow these instructions here to debug the problem in Safari dev tools: https://ionic.zone/debug/remote-debug-your-app#ios Look at the console and network tabs for errors.


#3

From the remote debug I get:

Failed to load resource: Request header field Content-Type is not allowed by Access-Control-Allow-Headers
XMLHttpRequest cannot load https://.../. Request header field Content-Type is not allowed by Access-Control-Allow-Headers.

#4

This is pretty clear - add this.

What plugins are you using? WKWebView maybe?


#5

There is cordova-plugin-ionic-webview, it was added when I have created the new blank project. Should I remove it to work as before?


#6

Read and understand http://blog.ionic.io/wkwebview-for-all-a-new-webview-for-ionic/


#7

Yep I have removed cordova-plugin-ionic-webview and everything works well. If I would like to use WKWebView I need to implement CORS on the server side (I use angular HTTPClient and don’t want to use @ionic-native/http). Not sure it is possible but will try to send to the backend some tips. Does anyone successfully implemented CORS on nginx?

Thanks @Sujan12