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

[GitHub] shazron closed pull request #867: [BLOG POST] - The Future of the iOS WebView in Apache Cordova

shazron closed pull request #867: [BLOG POST] - The Future of the iOS WebView in Apache Cordova
URL: https://github.com/apache/cordova-docs/pull/867
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 000000000..1cecbef9c
--- /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 purposes only -- developers should aim to support only WKWebView functionality going forward.
+
+## 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 23d5097bc..d4f3c299f 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 000000000..023913239
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 000000000..052b80260
Binary files /dev/null and b/www/static/img/blog/2018/bridge-webview-engine.png differ


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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