@Haroun wrote:
I use ionic 3 and I consume an API,
everything ok with android device and chrome browser after installing allow CORS plugin.But when i build an ios platform, it returns to me : “response with status 0 for url null”
Note that with ionic serve (chrome) in my mac works fine also after installing CORS plugin.
I tryed to install WKWebView, following this post, and this is my plugins :
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"
ionic-plugin-keyboard 2.2.1 “Keyboard”And also i add this to my config.xml < allow-navigation href=“API_URL” />
My code :
let headers = new Headers();
headers.append(‘Content-Type’, ‘application/x-www-form-urlencoded; charset=UTF-8’ );
headers.append(‘Access-Control-Allow-Origin’,’*’);let options = new RequestOptions({ headers: headers }); this.http.post("API_URL", "data=" + JSON.stringify({.... }), options).subscribe(res => { //parse data here }, error => { console.log(error); });
That gives me only on ios devise or emulator : “response with status 0 for url null”
Thaks for help
Posts: 1
Participants: 1