Ionic request doesn't work only on IOS

Hi all, i have an app with ionic and Angular that work fine on web and on Android device but i have this error on IOS device:

[error] - ERROR {“headers”:{“normalizedNames”:{},“lazyUpdate”:null,“headers”:{}},“status”:0,“statusText”:“Unknown Error”,“url”:“xxxxxxxxx/competition/getall”,“ok”:false,“name”:“HttpErrorResponse”,“message”:“Http failure response for xxxxxxxx/competition/getall: 0 Unknown Error”,“error”:{“isTrusted”:true}}

where xxxxxxx is my base address.
Where is the problem and how i can solve?

Can you give some more details what are you trying to do ?

In general API calls are not dependent from systems but from request.
Are you giving the proper/same request for the call ? (compare with web version).
Maybe you are using some data from storage and its not working in IOS ?

Hi, in this case no usage of storage.
The first call opening the app is a simple GET that work correctly on the web.

I paste here the request:
https://www.laps5.it:3000/cars/all

You can test in browser and it work fine.
If i try the IOS app on xcode emulator i have this error:
[error] - ERROR {“headers”:{“normalizedNames”:{},“lazyUpdate”:null,“headers”:{}},“status”:0,“statusText”:“Unknown Error”,“url”:“https://www.laps5.it:3000/cars/all",“ok”:false,“name”:“HttpErrorResponse”,“message”:"Http failure response for https://www.laps5.it:3000/cars/all: 0 Unknown Error”,“error”:{“isTrusted”:true}}

Solved!

It’s cors problem
On IONIC CAPACITOR it must be added to server side CORS to enable this:
‘capacitor://localhost’,

1 Like