Https post not working on iOS


I am using the following code to send a post request to my API which is working fine within the browser (with CORS disabled) and on a native Android build. However the same code built for iOS doesn’t work. The code is below:

return new Promise((resolve, reject) => {'/login/', data)
        .subscribe(res => {
        }, (err) => {

The output I see within Xcode when running the app is:

{"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}}

If I load my app via phone gap on iOS the API calls work fine, but fail when built via xcode and also when running via ionic view.

There is no point in explicitly instantiating a Promise in this situation.

1 Like

same here, works on android build and browser but never work on ios. any fix on this?