27

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

How can I retrieve a file using WKWebView?

Community
  • 1
  • 1
mm24
  • 9,280
  • 12
  • 75
  • 170

3 Answers3

19

According to Xcode 9, UIWebView is deprecated. ‍♂️

Xcode 9

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

Zelko
  • 3,793
  • 3
  • 34
  • 40
10

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.

Léo Natan
  • 56,823
  • 9
  • 150
  • 195
  • 1
    Cheers, thanks for the answer. For any update on the answer please feel free to edit and notify. – mm24 Sep 21 '15 at 07:57
  • 2
    Numerous crashes is a bane of UIWebView. For me migration to WKWebView solved *all* of them. That's alone a very good reason to migrate. – Alexander Vasenin May 19 '16 at 06:31
  • 2
    `UIWebView` will deprecated with iOS 11 release. :( – Suryakant Sharma Sep 01 '17 at 06:14
  • @Suryakant do you have any evidence of this? From their [official documentation](https://developer.apple.com/documentation/uikit/uiwebview?changes=latest_minor) deprecation is not mentioned? I just want to make informed decision. – Malba Sep 11 '17 at 21:49
  • 4
    @Malba See the below answer, so far only xcode is hinting about it. – Suryakant Sharma Sep 12 '17 at 05:00
2

As per Apple Developer site:

If your app still embeds web content using the deprecated UIWebView API, we strongly encourage you to update to WKWebView 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 using UIWebView as of December 2020.

Community
  • 1
  • 1
iammilind
  • 68,093
  • 33
  • 169
  • 336