Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS UIWebView Deprecating. What does this mean for Cordova apps?

Apple is deprecating UIWebView for iOS 12. (https://cordova.apache.org/news/2018/08/01/future-cordova-ios-webview.html)

I have a Cordova app and I have a few questions about this change:

  1. How can I tell if my app is using UIWebView?
  2. How soon is it expected that Apple will remove UIWebView altogether?
  3. Currently for Cordova apps it is recommended to install the WKWebView engine plugin. Based on the readme all I have to do is install this plugin and it makes Cordova use WKWebView. Is it really that easy? Once this is added I just build and can test knowing the app is using WKWebView only? https://github.com/apache/cordova-plugin-wkwebview-engine
like image 571
Brad Germain Avatar asked Aug 13 '18 13:08

Brad Germain


Video Answer


2 Answers

How can I tell if my app is using UIWebView?

If you use cordova-ios 5.x or lower without any framework, it will use UIWebView by default. If you use cordova-ios 6.0.0 or newer it uses WKWebView.

If you use Ionic, it uses it's own WKWebView plugin by default (if you started the app with Ionic CLI).

If you read the logs when the app starts, it will say, "Using UIWebView", or "Using WKWebView" or "Using Ionic WebView" or other similar messages.

How soon is it expected that Apple will remove UIWebView altogether?

Deprecated only means it's going to go away in the future, we can't know when, but it's safe to use it in iOS 12 and wasn't removed on iOS 13 neither. But you should start migrating as soon as possible. Apple has started showing a warning when an app is submitted, it appears even if you don't use UIWebView anymore because cordova-ios has UIWebView code and it's present in your app even if you switched to WKWebView. It's just a warning for now, but will reject apps in the future. It's still not decided what to do, you can check the discussion

Currently for Cordova apps it is recommended to install the WKWebView engine plugin. Based on the readme all I have to do is install this plugin and it makes Cordova use WKWebView. Is it really that easy? Once this is added I just build and can test knowing the app is using WKWebView only?

Yeah, it's that simple, but the WKWebView has some issues that might affect your app, so give it a try. As explained in the first point, the message should now say "Using WKWebView".

The know issues are reported in the blog post you linked. If they affect you, you can try the Ionic WebView, it uses WKWebView and the WKURLSchemeHandler to solve some of those problems. You don't need to use Ionic to use the Ionic WebView.

Cordova has a local web server plugin you can use wkwebview-engine-localhost that solves some of the problems, but it's not really good to have a web server running in your app.

like image 149
jcesarmobile Avatar answered Oct 28 '22 08:10

jcesarmobile


Cordova just released a version of Cordova iOS to remove UiWebView at compile time.

https://cordova.apache.org/announcements/2019/11/25/cordova-ios-release-5.1.0.html

Changelog:

The most notable improvements in this minor release are:
    The ability to disable UIWebView during the compile-time.

This is the linked PR:

https://github.com/apache/cordova-ios/pull/715
like image 25
Matteo Raizer Fanciulli Avatar answered Oct 28 '22 07:10

Matteo Raizer Fanciulli