CapacitorHTTP iOS Error

Hello everyone. I’m having an issue while using the CapacitorHTTP in my project. Im trying to get items from a database via a url. For Android it works fine, I am able to retrieve the items but on iOS, I get this error in the log:

Here is what my get method looks like:

   async getLocations(): Promise<any> {
     const options = {
         url: 'https://example.com/my/api',
         headers: {
           'Content-Type': 'application/json',
         }
     };

  return await CapacitorHttp.get(options);

   }

Heres what Android looks like:

I followed this guide: Capacitor Http Plugin API | Capacitor Documentation

I have found this issue in the GitHub repo that is similar to my issue:

@jcesarmobile stated that it was fixed in 4.6.2 but im on 4.6.3 and im still seeing the issue.

Can anyone please help me get this working in iOS?

Anyone have any ideas or can point me in the right direction?

Have you tried to use .request instead of get?

return await CapacitorHttp.request(options);

Yes, still shows the same error.

So I just decided to use cordova-plugin-advanced-http instead. In conclusion, CapacitorHttp does NOT work properly, not sure whats going on under the hood but switching to the cordova plugin worked in one shot. Thanks for you help @Hills90210!

1 Like

add .catch and print error messages, maybe there’s a more precise explanation