Is WKWebView designed as a replacement of UIWebView?

23,886

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. 🤷‍♂️

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

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 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.

Share:
23,886

Related videos on Youtube

mm24
Author by

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, 2020

Comments

  • mm24
    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

    How can I retrieve a file using WKWebView?

    • matt
      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
      yeahdixon almost 6 years
      uiwebview is now deprecated
    • Zelko
      Zelko over 4 years
      It's officially deprecated
    • brainray
      brainray over 4 years
      UIWebView now is not only deprecated but Apple will stop accepting submissions of apps that use UIWebView API
  • mm24
    mm24 over 8 years
    Cheers, thanks for the answer. For any update on the answer please feel free to edit and notify.
  • Alexander Vasenin
    Alexander Vasenin about 8 years
    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.
  • Suryakant Sharma
    Suryakant Sharma over 6 years
    UIWebView will deprecated with iOS 11 release. :(
  • Malba
    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
    Suryakant Sharma over 6 years
    @Malba See the below answer, so far only xcode is hinting about it.
  • Coder ACJHP
    Coder ACJHP over 4 years
    Then which class we may use instead of UIWebView for IOS 12?
  • Zelko
    Zelko over 4 years
    @CoderACJHP WKWebView