@lsantaniello wrote:
Hi friends,
I deployed my ionic app on my iphone but I receive this error when I invoke the REST API:
{"headers":{"normalizedNames":{},"lazyUpdate":null,"headers":{}},"status":0,"statusText":"Unknown Error","url":null,"ok":false,"name":"HttpErrorResponse","message":"Http failure response for (unknown url): 0 Unknown Error","error":{"isTrusted":true}}
During development into browser, I used CORS in order to disable cross origin control.
In my config.xml file I have:
<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:*" /> <allow-navigation href="*" />
My example code:
this.reqOpts = { headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Access-Control-Allow-Origin': '*' }, params: new HttpParams() };
login(username, password) { var url = ...; return new Promise(resolve => { this.http.get(url, this.reqOpts).subscribe( data => { resolve(data); }, err => { ... } ); }); }
Help me please
Luca
Posts: 1
Participants: 1