Is WKWebView designed as a replacement of UIWebView?
Solution 1
Update: UIWebView
is now deprecated and Apple is actively discouraging developers from using it.
There are several reasons, including security (out of process model), performance and memory management. Whether Apple would deprecate UIWebView
is not something anyone can answer but Apple, however considering the many limitations there currently are (some partially solved in WebKit2 source repository for future iOS WK2 framework inclusion), my educated guess would be that UIWebView
is here to stay for different needs. And considering both WebKitLegacy and WebKit2 (now renamed WebKit) frameworks reference the same implementation frameworks (WebCore, JSCore, etc.), it would not require a lot of work to keep UIWebView
alive.
Solution 2
According to Xcode 9, UIWebView
is deprecated. 🤷♂️
And a documentation message reads:
Legacy UIWebView for support of older macOS platforms. Prefer using WKWebView if possible.
Updated: UIWebView is deprecated for real now in iOS 12. https://developer.apple.com/documentation/uikit/uiwebview
Solution 3
As per Apple Developer site:
If your app still embeds web content using the deprecated
UIWebView
API, we strongly encourage you to update toWKWebView
as soon as possible for improved security and reliability.WKWebView
ensures that compromised web content doesn’t affect the rest of an app by limiting web processing to the app’s web view. And it’s supported in iOS and macOS, and by Mac Catalyst.The App Store will no longer accept new apps using
UIWebView
as of April 2020 and app updates usingUIWebView
as of December 2020.
Related videos on Youtube
mm24
switch(job): case MORNING: print."write code, research new technology, collaborate"; case NOON: print."write code, research new technology, collaborate"; case AFTERNOON: print."write code, research new technology, collaborate"; case EVENING: print.evaluate(time); case OTHER: print.evaluate(time); switch(contact-me): case STACKOVERFLOW: print."comment @mm24";
Updated on November 20, 2020Comments
-
mm24 over 3 years
Asking this questions as I am not sure why Apple introduced WKWebView without deprecating UIWebView. It is important to have an idea as I am programming a large code base and need to make an informed / fact based decision.
Are there any reason for which we may have to expect both classes to co-exist in the future and none get deprecated?
Is WKWebView purely designed for speed performance (using JIT) and will likely to serve only for certain use cases?
Current limitations of WKWebView:
https://mail.mozilla.org/pipermail/mobile-firefox-dev/2014-December/000993.html
-
matt about 9 years"I am wondering if UIWebView will get deprecated at all in the future" That is not a programming question. It is a question about the future. And about Apple. This is Stack Overflow, not a crystal ball.
-
yeahdixon almost 6 yearsuiwebview is now deprecated
-
Zelko over 4 yearsIt's officially deprecated
-
brainray over 4 yearsUIWebView now is not only deprecated but Apple will stop accepting submissions of apps that use UIWebView API
-
mm24 over 8 yearsCheers, thanks for the answer. For any update on the answer please feel free to edit and notify.
-
Alexander Vasenin about 8 yearsNumerous crashes is a bane of UIWebView. For me migration to WKWebView solved all of them. That's alone a very good reason to migrate.
-
Suryakant Sharma over 6 years
UIWebView
will deprecated with iOS 11 release. :( -
Malba over 6 years@Suryakant do you have any evidence of this? From their official documentation deprecation is not mentioned? I just want to make informed decision.
-
Suryakant Sharma over 6 years@Malba See the below answer, so far only xcode is hinting about it.
-
Coder ACJHP over 4 yearsThen which class we may use instead of UIWebView for IOS 12?
-
Zelko over 4 years@CoderACJHP WKWebView