You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2018/08/09 02:21:06 UTC

[cordova-docs] branch master updated: [BLOG POST] - Breaking changes coming to the iOS WebView in Apache Cordova (#867)

This is an automated email from the ASF dual-hosted git repository.

shazron pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-docs.git


The following commit(s) were added to refs/heads/master by this push:
     new dd5bbaa  [BLOG POST] - Breaking changes coming to the iOS WebView in Apache Cordova (#867)
dd5bbaa is described below

commit dd5bbaa4c2eb297b9116c27dc75a100a903fbff6
Author: Shazron Abdullah <sh...@gmail.com>
AuthorDate: Thu Aug 9 10:21:04 2018 +0800

    [BLOG POST] - Breaking changes coming to the iOS WebView in Apache Cordova (#867)
---
 .../2018-08-01-future-cordova-ios-webview.md       |  72 +++++++++++++++++++++
 www/static/css-src/_blog.scss                      |   4 ++
 www/static/img/blog/2018/arch-webview-engine.png   | Bin 0 -> 14683 bytes
 www/static/img/blog/2018/bridge-webview-engine.png | Bin 0 -> 18100 bytes
 4 files changed, 76 insertions(+)

diff --git a/www/_posts/2018-08-01-future-cordova-ios-webview.md b/www/_posts/2018-08-01-future-cordova-ios-webview.md
new file mode 100644
index 0000000..1cecbef
--- /dev/null
+++ b/www/_posts/2018-08-01-future-cordova-ios-webview.md
@@ -0,0 +1,72 @@
+---
+layout: post
+author:
+    name: Shazron Abdullah
+    url: https://twitter.com/shazron
+title:  "Breaking changes coming to the iOS WebView in Apache Cordova"
+categories: news
+tags: cordova-ios uiwebview wkwebview webview roadmap
+---
+
+With the announcement of the iOS 12 beta SDK at Appleā€™s WWDC 2018, came the news that UIWebView, the webview originally bundled with the first iOS SDK, has been [deprecated](https://developer.apple.com/documentation/uikit/uiwebview). What this means for iOS developers is that sometime in the future, Apple will remove UIWebView from their SDK, and developers should migrate to using the WKWebView component starting right now.
+
+## WebView Engine Plugins
+
+Cordova iOS, starting with version 4, has anticipated this by moving the webview that is used by the platform into a plugin. The default webview that is used is still UIWebView, but you had the option to use WKWebView instead, with the [cordova-plugin-wkwebview-engine](https://github.com/apache/cordova-plugin-wkwebview-engine) plugin. Both the UIWebView and WKWebView webviews are plugins themselves, with the former included in the cordova-ios platform.
+
+![Figure 1]({{ site.baseurl }}/static/img/blog/2018/arch-webview-engine.png)
+
+## Cordova iOS 5 with WKWebView
+
+Starting with Cordova iOS version 5, which is a planned upcoming release, we will ship both webview plugins with the cordova-ios platform, to enable developers to test and transition users to the new WKWebView component. Cordova iOS 5 will ship with a bridge webview plugin that can switch usage of the webview plugin used at runtime. Previously, you could only choose which webview you would use at build time.
+
+![Figure 2]({{ site.baseurl }}/static/img/blog/2018/bridge-webview-engine.png)
+
+<!--more-->
+
+## Migration and Transition using the Bridge WebView Plugin
+
+The developer can switch the webview used by setting a preference, that will be read at runtime when the app starts. Developers can transition users to the new WKWebView by user choice, in their app settings -- or randomly perhaps as an A/B test. This will give the developer and their users a chance to try out the new component, and they can back out and use UIWebView if there are any problems, without needing a new app release. This is intended to be used for testing and migration purpo [...]
+
+## Cordova iOS Future Release, WKWebView only
+
+When UIWebView support has been removed in a future iOS SDK, we will aim to release a future Cordova iOS version, which will remove UIWebView support, and WKWebView will then be the default webview engine.
+
+| Cordova iOS 4 >>> | Cordova iOS 5 >>> | Cordova iOS Future Release |
+|-------------------|-------------------|---------------|
+|  | UIWebView deprecated | UIWebView removed |
+|  | WKWebView Engine Plugin Integrated Into Platform | WKWebView Engine Plugin only |
+|  | Bridge WebView Plugin Added | Bridge WebView Plugin Removed |
+
+
+## Limitations of WKWebView
+
+There are [many limitations](https://mjtsai.com/blog/2018/06/20/webview-and-uiwebview-deprecated-in-favor-of-wkwebview/) of WKWebview, especially if you were using UIWebView previously. The limitations are:
+
+1. Cookies don't persist. This is a WebKit bug, but someone has
+created a plugin for a workaround. See
+[CB-12074](https://issues.apache.org/jira/browse/CB-12074)
+2. Can't delete cookies. This is/was a WebKit bug (2015), we need to test
+for the iOS 11/12. See [CB-11297](https://issues.apache.org/jira/browse/CB-11297)
+3. Can't execute JavaScript code in the background. There are several
+issues related to this. See
+[CB-12815](https://issues.apache.org/jira/browse/CB-12815)
+4. XmlHttpRequests don't work, because of Cross-Origin Resource
+Sharing issue (CORS). There is a workaround plugin created by Oracle
+(UPL licensed, which is Apache-2.0 compatible). See
+[CB-10143](https://issues.apache.org/jira/browse/CB-10143)
+5. Migration of localStorage from UIWebView. There is a migration
+plugin available. See [CB-11974](https://issues.apache.org/jira/browse/CB-11974)
+6. iframes will not be supported any longer (they are now CORS restricted in WKWebView), and may be partially or completely broken. This may lead to incompatibilities with the same code in other Cordova platforms.
+7. Known issues with WKWebView on iOS pre-11 which will be deprecated and dropped in a future Cordova release
+
+There are several bugs that need to be resolved as well. The full list
+here: [https://s.apache.org/QfsF](https://s.apache.org/QfsF)
+
+As you can see, WKWebView is not a direct drop-in replacement for UIWebView, you will need several plugins to patch functionality that is missing. There is also the [local-webserver experimental plugin option](https://github.com/apache/cordova-plugins/tree/wkwebview-engine-localhost), which will not be graduated to a full plugin -- we will concentrate our efforts on supporting the main WKWebView engine plugin. 
+
+Hopefully with more testing, and filing of bug reports with Apple for missing features, the WKWebView can be a full replacement for Cordova users.
+
+
+
+
diff --git a/www/static/css-src/_blog.scss b/www/static/css-src/_blog.scss
index 23d5097..d4f3c29 100644
--- a/www/static/css-src/_blog.scss
+++ b/www/static/css-src/_blog.scss
@@ -1,4 +1,8 @@
 .blog {
+
+    table, td, th {
+        border: 1px solid black;
+    }
     .blogHeader {
         color: #b58733;
         font-size: 30pt;
diff --git a/www/static/img/blog/2018/arch-webview-engine.png b/www/static/img/blog/2018/arch-webview-engine.png
new file mode 100644
index 0000000..0239132
Binary files /dev/null and b/www/static/img/blog/2018/arch-webview-engine.png differ
diff --git a/www/static/img/blog/2018/bridge-webview-engine.png b/www/static/img/blog/2018/bridge-webview-engine.png
new file mode 100644
index 0000000..052b802
Binary files /dev/null and b/www/static/img/blog/2018/bridge-webview-engine.png differ


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org