{"id":21863,"date":"2018-06-20T10:46:40","date_gmt":"2018-06-20T14:46:40","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=21863"},"modified":"2020-02-24T15:44:53","modified_gmt":"2020-02-24T20:44:53","slug":"webview-and-uiwebview-deprecated-in-favor-of-wkwebview","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2018\/06\/20\/webview-and-uiwebview-deprecated-in-favor-of-wkwebview\/","title":{"rendered":"WebView and UIWebView Deprecated in Favor of WKWebView"},"content":{"rendered":"<p><a href=\"https:\/\/twitter.com\/bradeeoh\/status\/1009302764722184192\">Brady Eidson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/bradeeoh\/status\/1009302764722184192\">\n<p>I hope most of you have heard the news by now, but <code>UIWebView<\/code> has been formally deprecrated.<\/p>\n<p>That means it <em>is<\/em> going away altogether in a future release.<\/p>\n<p>Please start adopting <code>WKWebView<\/code> now, and please ping me directly with any issues that arise.<\/p>\n<p>(Same goes for <code>WebView<\/code> on Mac)<\/p>\n<\/blockquote>\n<p>The separate process architecture is nice, but this is going to be a rough transition. It looks like <code>WKWebView<\/code> is still missing tons of features from <code>WebView<\/code> (Web archives, DOM, customized loading and display, probably more that I haven&rsquo;t discovered yet). The limitations are so severe that I bet a lot of apps haven&rsquo;t even looked much into switching. Other features will be possible to port, but the API is very different, and in many cases you&rsquo;ll need to switch from Swift\/Objective-C to JavaScript. I was expecting to see massive improvements to <code>WKWebView<\/code> before <code>WebView<\/code> was deprecated, but that doesn&rsquo;t seem to be happening.<\/p>\n\n<p>See also: <a href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2018\/234\/\">What&rsquo;s New in Safari and WebKit<\/a>.<\/p>\n\n<p>Previously: <a href=\"https:\/\/mjtsai.com\/blog\/2017\/12\/22\/wkwebview-workarounds\/\">WKWebView Workarounds<\/a>, <a href=\"https:\/\/mjtsai.com\/blog\/2015\/01\/20\/wkwebview-sandboxing-and-searching\/\">WKWebView, Sandboxing, and Searching<\/a>, <a href=\"https:\/\/mjtsai.com\/blog\/2014\/06\/06\/wkwebview\/\">WKWebView<\/a>.<\/p>\n\n<p>Update (2018-06-20): The WWDC session has no useful information about switching to <code>WKWebView<\/code>, and the presenter implies that it&rsquo;s easy.<\/p>\n\n<p><a href=\"https:\/\/twitter.com\/bradeeoh\/status\/1009476672918204416\">Steve Harris<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/bradeeoh\/status\/1009476672918204416\">\n<p>As @mjtsai the inability to create web archives is a problem for me (and adding iOS support would be great), while printing \/ saving PDFs doesn&rsquo;t work at all on Mac<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/matt_sven\/status\/1009480468453093376\">Matt Curtis<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/matt_sven\/status\/1009480468453093376\">\n<p>On the subject, is there a way to invoke copy from a <code>WKWebView<\/code> while preserving rich text? I tried a while back and it doesn&rsquo;t seem to work using the usual <code>UIResponder<\/code> methods.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/isaiah\/status\/1009492225552764936\">Isaiah Carew<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/isaiah\/status\/1009492225552764936\">\n<p>My main income is Stack for Rapidweaver. The vast majority of the UI handled by manipulating the DOM directly. <\/p>\n<p>That is not possible in a <code>WKWebView<\/code>.<\/p>\n<p>If <code>WebView<\/code> is removed my business will die and strand thousand of customers.<\/p>\n<\/blockquote>\n<blockquote cite=\"https:\/\/twitter.com\/isaiah\/status\/1009529837688643600\">\n<p>the issue is that they&rsquo;ve cut off most of the fast APIs.<\/p>\n<p>this was, i&rsquo;m sure, done to improve security and avoid content policy injection.<\/p>\n<p>unfortunately it really limits the utility of the view.<\/p>\n<p>it&rsquo;s basically just a web page viewer now.<\/p>\n<\/blockquote>\n\n<p>Update (2018-06-23): See also: <a href=\"https:\/\/coreint.org\/2018\/06\/episode-333-i-will-be-speaking-briefly\/\">Core Intuition<\/a>.<\/p>\n\n<p>Update (2018-06-24): <a href=\"https:\/\/twitter.com\/radiofreelunch\/status\/1009487928534265856\">David Dunham<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/radiofreelunch\/status\/1009487928534265856\">\n<p>I tried using it but got random crashes and went back to UIWebView.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/danielpunkass\/status\/1009788255519297536\">Daniel Jalkut<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/danielpunkass\/status\/1009788255519297536\">\n<p>We who rely upon WebView DOM manipulation really have our work cut out for us. We have to at least file the bugs with Apple and hope for accommodations where we need them.<\/p>\n<\/blockquote>\n\n<p>Update (2018-08-01): <a href=\"https:\/\/eclecticlight.co\/2018\/07\/31\/one-small-change-which-might-break-a-lot-of-older-apps\/\">Howard Oakley<\/a>:<\/p>\n<blockquote cite=\"https:\/\/eclecticlight.co\/2018\/07\/31\/one-small-change-which-might-break-a-lot-of-older-apps\/\">\n<p>When WebViews are lost from macOS, a great many older apps will still expect to find them, and you should expect their behaviour to be untoward at least. I suspect that will kill far more apps than any future requirement for them to be 64-bit. And there&rsquo;s no easy way to discover which apps are dependent on WebView.<\/p>\n<\/blockquote>\n\n<p>Update (2018-08-10): <a href=\"https:\/\/cordova.apache.org\/news\/2018\/08\/01\/future-cordova-ios-webview.html\">Shazron Abdullah<\/a>:<\/p>\n<blockquote cite=\"https:\/\/cordova.apache.org\/news\/2018\/08\/01\/future-cordova-ios-webview.html\">\n<p>There are <a href=\"https:\/\/mjtsai.com\/blog\/2018\/06\/20\/webview-and-uiwebview-deprecated-in-favor-of-wkwebview\/\">many limitations<\/a> of WKWebview, especially if you were using UIWebView previously. The limitations are:<\/p>\n\n<ol>\n<li>Cookies don&rsquo;t persist. This is a WebKit bug, but someone has\ncreated a plugin for a workaround. See\n<a href=\"https:\/\/issues.apache.org\/jira\/browse\/CB-12074\">CB-12074<\/a><\/li>\n<li>Can&rsquo;t delete cookies. This is\/was a WebKit bug (2015), we need to test\nfor the iOS 11\/12. See <a href=\"https:\/\/issues.apache.org\/jira\/browse\/CB-11297\">CB-11297<\/a><\/li>\n<li>Can&rsquo;t execute JavaScript code in the background. There are several\nissues related to this. See\n<a href=\"https:\/\/issues.apache.org\/jira\/browse\/CB-12815\">CB-12815<\/a><\/li>\n<li>XmlHttpRequests don&rsquo;t work, because of Cross-Origin Resource\nSharing issue (CORS). There is a workaround plugin created by Oracle\n(UPL licensed, which is Apache-2.0 compatible). See\n<a href=\"https:\/\/issues.apache.org\/jira\/browse\/CB-10143\">CB-10143<\/a><\/li>\n<li>Migration of localStorage from UIWebView. There is a migration\nplugin available. See <a href=\"https:\/\/issues.apache.org\/jira\/browse\/CB-11974\">CB-11974<\/a><\/li>\n<li>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.<\/li>\n<li>Known issues with WKWebView on iOS pre-11 which will be deprecated and dropped in a future Cordova release<\/li>\n<\/ol>\n\n<p>There are several bugs that need to be resolved as well. The full list\nhere: <a href=\"https:\/\/s.apache.org\/QfsF\">https:\/\/s.apache.org\/QfsF<\/a><\/p>\n<\/blockquote>\n\n<p id=\"webview-and-uiwebview-deprecated-in-favor-of-wkwebview-update-2018-11-26\">Update (2018-11-26): See also: <a href=\"https:\/\/coreint.org\/2018\/11\/episode-351-heres-the-downside\/\">Core Intuition<\/a>.<\/p>\n\n<p id=\"webview-and-uiwebview-deprecated-in-favor-of-wkwebview-update-2019-06-14\">Update (2019-06-14): <a href=\"https:\/\/twitter.com\/bradeeoh\/status\/1136358340605251584\">Brady Eidson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/bradeeoh\/status\/1136358340605251584\">\n<p>It&rsquo;s been a year since we formally deprecated UIWebView and WebView.<\/p>\n<p>They&rsquo;re still in iOS 13 and macOS Catalina but are still going away in future releases.<\/p>\n<p>We&rsquo;ve gathered <em>tons<\/em> of great feedback in the last year, but want even more.<\/p>\n<\/blockquote>\n\n<p id=\"webview-and-uiwebview-deprecated-in-favor-of-wkwebview-update-2019-08-15\">Update (2019-08-15): <a href=\"https:\/\/twitter.com\/hisaac\/status\/1161623813467058178\">Isaac Halvorson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/hisaac\/status\/1161623813467058178\"><p>I&rsquo;ve spent the last two weeks migrating a simple WebView to WKWebView in our macOS app due to an issue in Catalina. Now that I&rsquo;ve finished, it works fine in Catalina, but is broken in pre-Catalina macOS versions. So I guess I&rsquo;ll just inject one or the other depending on what OS?<\/p><p>This has been a ridiculous process, especially because of the huge lack of APIs WKWebView has compared to the old WebView. WebView makes things SO much easier. I had to write a ton of custom code just to make WKWebView do the same things WebView does out of the box.<\/p><\/blockquote>\n\n<p id=\"webview-and-uiwebview-deprecated-in-favor-of-wkwebview-update-2019-11-06\">Update (2019-11-06): <a href=\"https:\/\/twitter.com\/kcase\/status\/1191766268258291712\">Ken Case<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/kcase\/status\/1191766268258291712\">\n<p>OmniWeb is in an awkward place right now, rebuilt on top of WebKit 2 only to discover it doesn&rsquo;t support some essential features a daily-use browser needs&mdash;like password autofill.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Brady Eidson: I hope most of you have heard the news by now, but UIWebView has been formally deprecrated. That means it is going away altogether in a future release. Please start adopting WKWebView now, and please ping me directly with any issues that arise. (Same goes for WebView on Mac) The separate process architecture [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2018-08-10T17:35:37Z","apple_news_api_id":"8c72b57e-9290-407a-b860-256c9351c7b3","apple_news_api_modified_at":"2020-02-24T20:44:57Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAADA==","apple_news_api_share_url":"https:\/\/apple.news\/AjHK1fpKQQHq4YCVsk1HHsw","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[31,1667,30,1609,207,1889,71,328,1926],"class_list":["post-21863","post","type-post","status-publish","format-standard","hentry","category-technology","tag-ios","tag-ios-13","tag-mac","tag-macos-10-14","tag-marsedit","tag-omniweb","tag-programming","tag-webkit","tag-wkwebview"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/21863","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=21863"}],"version-history":[{"count":13,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/21863\/revisions"}],"predecessor-version":[{"id":27204,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/21863\/revisions\/27204"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=21863"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=21863"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=21863"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}