In iOS, there have been two webviews for a few years now, UIWebView and WKWebView. Historically, Ionic apps have used
UIWebView, but no longer. Ionic now uses WKWebview by default when building for iOS.
We strongly believe WKWebview is the best option for any app, as it features many improvements over the older, legacy
webview (UIWebView). These features include:
1. JIT conversion of JS code down to machine code, which runs much faster
2. Improved rendering performance
3. Less memory consumption
4. Better adherence to web standards
5. Reliable scroll events (important for virtual-list)
We wanted to make sure that people could easily switch to WKWebView without many issues, but there are still some things that you’ll need to consider.
Update Ionic CLI
WKWebView plugin needs latest Ionic CLI in order to work properly.
Please make sure that your global CLI is using the latest 3.x release. If not, please upgrade:
npm uninstall -g ionic
npm install -g ionic
Upgrading to WKWebView (UIWebView users only)
Update all plugins of your Application with latest Version of these Plugins
Especially Ionic Webview plugn By Using this command
App data is not copied over
I just migrated from UIWebView to WKWebView and the storage data looks lost.
Since WKWebView is essentially a new browser, any data that you could have in LocalStorage or IndexDB will not be copied over. In this case, migrating data to a native storage mechanism, SQLite, is suggested to make sure that the data will still be available.
We strongly recommend to use the ionic-storage package which abstracts aways most of the problems with persistent storage.
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:
rm -rf platforms
rm -rf plugins
Add the platform back
ionic cordova platform add ios
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" />
Build ionic ios
ionic cordova build ios
Open Xcode and try to build again
UIWebView, but no longer. Ionic now uses WKWebview by default when building for iOS.
We strongly believe WKWebview is the best option for any app, as it features many improvements over the older, legacy
webview (UIWebView). These features include:
1. JIT conversion of JS code down to machine code, which runs much faster
2. Improved rendering performance
3. Less memory consumption
4. Better adherence to web standards
5. Reliable scroll events (important for virtual-list)
We wanted to make sure that people could easily switch to WKWebView without many issues, but there are still some things that you’ll need to consider.
Update Ionic CLI
WKWebView plugin needs latest Ionic CLI in order to work properly.
Please make sure that your global CLI is using the latest 3.x release. If not, please upgrade:
npm uninstall -g ionic
npm install -g ionic
Upgrading to WKWebView (UIWebView users only)
Update all plugins of your Application with latest Version of these Plugins
Especially Ionic Webview plugn By Using this command
ionic cordova plugin add cordova-plugin-ionic-webview --save
I just migrated from UIWebView to WKWebView and the storage data looks lost.
Since WKWebView is essentially a new browser, any data that you could have in LocalStorage or IndexDB will not be copied over. In this case, migrating data to a native storage mechanism, SQLite, is suggested to make sure that the data will still be available.
We strongly recommend to use the ionic-storage package which abstracts aways most of the problems with persistent storage.
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:
rm -rf platforms
rm -rf plugins
Add the platform back
ionic cordova platform add ios
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" />
Build ionic ios
ionic cordova build ios
Open Xcode and try to build again
Switching to WKWebView from the conventional WebView in Ionic enhances app performance and compatibility. How Win Game WKWebView offers improved rendering speed and modern web standards support.
ReplyDelete