[英]Is WKWebView designed as a replacement of UIWebView?
Asking this questions as I am not sure why Apple introduced WKWebView without deprecating UIWebView.问这个问题,因为我不知道为什么 Apple 在不弃用 UIWebView 的情况下引入了 WKWebView。 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? WKWebView 是否纯粹是为了速度性能(使用 JIT)而设计的,并且可能仅适用于某些用例?
Current limitations of WKWebView: WKWebView 的当前限制:
https://mail.mozilla.org/pipermail/mobile-firefox-dev/2014-December/000993.html https://mail.mozilla.org/pipermail/mobile-firefox-dev/2014-December/000993.html
How can I retrieve a file using WKWebView? 如何使用 WKWebView 检索文件?
According to Xcode 9, UIWebView
is deprecated.根据 Xcode 9,不推荐使用
UIWebView
。 🤷♂️ 🤷♂️
And a documentation message reads:文档消息如下:
Legacy UIWebView for support of older macOS platforms.
用于支持旧版 macOS 平台的旧版 UIWebView。 Prefer using WKWebView if possible.
如果可能,最好使用 WKWebView。
Updated: UIWebView is deprecated for real now in iOS 12. https://developer.apple.com/documentation/uikit/uiwebview更新: UIWebView 现在在 iOS 12 中被真正弃用了。 https://developer.apple.com/documentation/uikit/uiwebview
Update: UIWebView
is now deprecated and Apple is actively discouraging developers from using it.更新:
UIWebView
现在已被弃用,Apple 正在积极劝阻开发人员不要使用它。
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. Apple 是否会弃用
UIWebView
不是任何人都可以回答的问题,但 Apple 无法回答,但是考虑到目前存在的许多限制(一些在 WebKit2 源代码库中部分解决以供未来的 iOS WK2 框架包含),我有根据的猜测是UIWebView
将继续存在不同的需求。 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.并且考虑到 WebKitLegacy 和 WebKit2(现在更名为 WebKit)框架都引用了相同的实现框架(WebCore、JSCore 等),因此不需要大量的工作来保持
UIWebView
活动。
As per Apple Developer site :根据Apple 开发者网站:
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.如果您的应用程序仍然使用已弃用的
UIWebView
API 嵌入 Web 内容,我们强烈建议您尽快更新到WKWebView
以提高安全性和可靠性。WKWebView
ensures that compromised web content doesn't affect the rest of an app by limiting web processing to the app's web view.WKWebView
通过将 Web 处理限制为应用程序的 Web 视图,确保受损的 Web 内容不会影响应用程序的其余部分。 And it's supported in iOS and macOS, and by Mac Catalyst.它在 iOS 和 macOS 以及 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.自 2020 年 4 月起,App Store 将不再接受使用
UIWebView
新应用程序和自 2020 年 12 月起使用UIWebView
应用程序更新。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.