http requests issue with WP rest API when ionic iOS native

WP Rest API calls not working in iOS version of Ionic App

338 0

I have been a fun of Ionic since V1. I have develop many news app with this framework. Today I upgrade one of my apps to Ionic5

The app is using WordPress backend meaning I am pulling the news from my blog using  http Get requests. I was able to test the app with Ionic  serve in the browser and deploy it with Android.

For the iOS version with XCode, I am not seeing any post after my splash screen in the simulator.

 I spend times trying to check what I have missed: From upgraded XCode, upgrade my OS, try deploying to a real device… etc. nothing.

The app is working fine in Android but failing to display news in iOS device.However the splash screen displays then disapears, and nothing after.

. I decided to put more log in my code and boom, the call is refused. I could not think about CORS since the app is working with Android.

So Ionic is using ionic://localhost as origin. This mean we

To solve it please go to your theme and find functions.php  and add the following

add_filter('kses_allowed_protocols', function($protocols) {
    $protocols[] = 'ionic';
    return $protocols;
});

That is it. !

Related Post