HTTP Get Requests (Wordpress website Rest API calls) not working in iOS App

My Ionic4 App (with angular) is published in both PlayStore (Android) and App Store (iOS). App is expected to show latest articles from website. App makes http get request to fetch json data (calling the wordpress rest api at url Sample code from page ts file:

import { HttpClient} from ‘@angular/common/http’;

this.http.get(url).pipe(map(res => {return res}));

My app is working fine in Android but failing to display content in iOS device.

Apple support team is unable to help as they only look into swift code. For Ionic code, they are suggesting to get help from Ionic community experts. This issue has blocked our release and became a show stopper for us. Request you to help us resolving this issue at the earliest.

In case there is any other channel/option to get faster service from Ionic experts, kindly suggest.

iOS app link is
Android app link is

Nanda Kishore

My guess is it’s likely a CORS issue and WKWebView. Do you have CORS setup on the wordpress api? Here’s a couple of posts that should help if that’s the problem.

The first explains CORS and Ionic by Josh Morony.

The second is enabling CORS on Wordpress. ***Make sure you read up on Access-Control-Allow-Origin and be careful on what you are allowing. Only allow the methods you need ie: GET.


1 Like

Thank you @caffic for responding. I have looked at the articles shared but it didn’t help. CORS is not an issue here as it is working fine when I run it in the browser and from Android device.

Do you face any console errors while debugging ios?

I would focus attention on the server; I don’t think this is an Ionic issue. Your SSL cert is for, not the bare domain.

I had the same problem. This is the solution I applied:

“The problem was caused by ionic sending ionic://localhost as the origin when used as a compiled app. WP REST responds through rest_send_cors_headers, which passes the origin through esc_url_raw and rejects the url due to its protocol.”