Network Error on IOS emulator. Works on android and PWA

I am receiving a Network Error when making https requests to my API that is only occurring while emulating with XCode. The problem does not occur when running locally www, or in a published website or on Android Studio emulators or published to android device.

Not sure if I am missing a permission or configuration, but I have tried adding “Local Network Usage”, “Location Always and When In Use” permissions to the Info.plist.

I do not believe its an issue with my server since it works on other platforms and I have already tried changing settings around such as allowing all origins through CORS and nothing has made a difference.

I am using Angular Capacitor v3 with axios. (I have also tried HttpClient with the same result)

The error occurs immediately and does not give specific information but here is the message:

[error] - %c2021-09-26T01:13:16.694Z ERROR color:red {“message”:“Network Error”,“name”:“Error”,“stack”:“capacitor://localhost/main.1.js:1:512713\ncapacitor://localhost/main.1.js:1:508465\nO@capacitor://localhost/polyfills.2.js:1:12849\nonInvokeTask@capacitor://localhost/main.1.js:1:142090\ncapacitor://localhost/polyfills.2.js:1:3118\ncapacitor://localhost/polyfills.2.js:1:9168\ng@capacitor://localhost/polyfills.2.js:1:21778\ny@capacitor://localhost/polyfills.2.js:1:22006”,
“config”:{“url”:“”,“method”:“post”,“data”:“{[data]}”,“headers”:{“Accept”:“text/plain”,“Content-Type”:“application/json”,“Access-Control-Allow-Origin”:“*”,“Authorization”:“Bearer [token]”},“transformRequest”:[null],“transformResponse”:[null],“timeout”:0,“withCredentials”:true,“xsrfCookieName”:“XSRF-TOKEN”,“xsrfHeaderName”:“X-XSRF-TOKEN”,“maxContentLength”:-1,“maxBodyLength”:-1,“transitional”:{“silentJSONParsing”:true,“forcedJSONParsing”:true,“clarifyTimeoutError”:false}}}

Anyone come across this issue? I am lost here and cannot support ios for my app with capacitor at this point. I have searched extensively and see several related issues but no solutions. I’ve also tried posting on stackoverflow and nothing so far.

After extensive research and rebuilding from scratch, I found this was a CORS related issue but specific to setup with Azure, which was my hosted server. The confusing part was that even external example calls, such as to “http://jsonplaceholder.typicode.com/users/1” still gave the same error, which wouldn’t have CORS issues, as far as I understand. If anyone knows why that happens, please let me know.

This was related to the fact that in ios, the http/https schemes cannot be used, instead it uses capacitor. This scheme is not allowed in Azure App Service CORS settings, unless you allow all, but I could not because I needed to enable Access-Control-Allow-Credentials. So I had to build the CORS configuration with the capacitor scheme allowed in my C# app service code. Removing all settings from CORS in Azure App Service then allowed the settings in my C# code to be applied.