On December 23rd, 2019, Apple clarified plans for UIWebView: “The App Store will no longer accept new apps using UIWebView as of April 2020 and app updates using UIWebView as of December 2020.” Please follow the instructions below to either update to a newer version of Cordova or migrate to Capacitor.
So there some simple steps to add WKWebview in an existing Ionic 3 and Ionic 4 Application.
1. First make sure Ionic/cli is not less than 3.If you have ionic/cli version less than 3 please update it 3.x or greater any version is ok no need to update it.
2. You need to Update your Cordova from existing version to minimum version (Cordova 9.0.0 )
3. Update Your all plugins which are installed in you Application with Latest version .Because the older version of cordova plgins uses UIWebview.
4. Run these command to Update your ionic-webview plugin
ionic cordova plugin add cordova-plugin-ionic-webview
npm install @ionic-native/ionic-webview
5. If you are using InAppBrowser plugin in your Application. Make sure its version greater than 3.2.0
Because this version use WKWebview not UIWebView.
Now it's time to add WkWebview externally in our existing Application (All latest version of cordova plugin uses WKWebview but some plugins having UIWebview refrences. So, that's
why we need to add WKWebview externally.
Add these links in Your Config.xml file inside <platform name ="ios> Tag
Make sure localhost is allowed:
<allow-navigation href="http://localhost:8080/*"/>
Make sure WKWebView is the default engine:
<feature name="CDVWKWebViewEngine"><param name="ios-package" value="CDVWKWebViewEngine" /></feature><preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" /><preference name="WKWebViewOnly" value="true" /> Run this command after complete this stepionic cordova prepare ios
First remove cordova ios
ionic cordova platform remove ios
Add cordova for ios
ionic cordova platform add ios@5.1.0
My app does not load, white screen
I don’t have any error in my code, but still I get a blank screen
Most of the time, this kind of problems come from an incorrect installation of the Cordova platform:
Ensure Xcode is closed
Clean install:
ionic cordova platform remove ios
rm -rf platforms
rm -rf plugins
Add the platform back
ionic cordova plugin plugin add ios@5.1.0
Why we use cordova-ios@5.1.0 specific version for codova for ios Build.
The most notable improvements in this minor release are:
- The ability to disable
UIWebView
during the compile-time. - Avoid locking when adding platforms on a non-synced pods repo. (CocoaPods >=1.8.0)
- Bumped the
minDeploymentTarget
to10.0
in Podfile.
That's all guy's .Hopefully this post is helpfull for you. If you have any problem regarding this post.Please comment on it .Thank's
If you need professional help for your project do let us know.
You can directly contact us on developers.omitech@gmail.com
Adding WKWebView to an existing app involves several steps. Begin by importing the necessary framework and configuring the WKWebView instance. How Use VPN Then, integrate it into your app's view hierarchy and handle its navigation and interaction logic.
ReplyDelete