Smooth Migration to WKWebview from UIWebview in IONIC

If you have a version IOS App on Appstore with UIWebview you would have received the above warning after delivery the App on AppStore connect.
So let’s try to Understand what is it
Understanding ITMS-90809: UIWebView API Deprecation
Recently Apple introduced new App submission warning stating that they are formally depreciating UIWebview . Here below link from ionic blog you will find more information how to migrate to WkWebView which is not that difficult.
Basically it’s nothing to do with IONIC version .The warning related the cordova runtime , basically you have to update the version of cordova you are currently using.
By default cordova ios 5.5 disables the UIWebview
Please follow the above link from ionicframework blog how to upgrade to WKWebview from UIWebview
But here we will discuss something different that is what would be issue we can face while migrating to WKWebview
Potential problems you can face while migrating to WKWebview
- CORS issues with WebWebView
What is CORS
Let’s discuss how to handle to with minimal code change and more clean way.
CORS is one issue you can face of previously your application using cross origin request which is currently not possible with WKWebView due to security vulnerability with cross origin request.
Solution
There are basically two solution for this issue.
Option 1
Enable CORS from server
If you don't have control over the server or you have some constraints thats you cant enable cors for some reason , then you can look for the solution 2
Option 2
There is an efficient and faster way to call REST API’s using by still using WKWebview but call should happen natively not through the Webview .
for IONIC 4+
For IONIC 3
Just you have to change the way you are calling the websevices .. Calling natively is more faster it reduce one thing that is preflight request.You can learn more about it .
If you still have any problem or issue around migrating to WKWebview please comment down below i will happy to help 👍🏽