Xcode 9 GM - WKWebView NSCoding 支持在以前的版本中被破坏 [英] Xcode 9 GM - WKWebView NSCoding support was broken in previous versions

查看:21
本文介绍了Xcode 9 GM - WKWebView NSCoding 支持在以前的版本中被破坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何用 Xcode 9 GM 修复这个错误?我正在开发一个用 Xcode 8.3 制作的应用程序,部署目标是针对 iOS 9.3 的,我以前从未遇到过这个问题.我还没有在这里或在 Apple 论坛上找到任何信息:(

Does anyone know how to fix this error with Xcode 9 GM? I'm working on an app made with Xcode 8.3, the deployment target is for iOS 9.3 and I never had this problem before. I don't find any information here or on Apple forums yet :(

当我将 WKWebView 放入界面构建器时出现此错误,而不是我以编程方式使用它时.

This error came when I put a WKWebView into interface builder, not if I use it programmatically.

编辑 2:嗯,这终于不是错误了,请参阅下面的 Quinn 回答以了解有关此行为的更多信息.感谢他的解释.

推荐答案

该错误是正确的行为,而不是 Xcode 9 中的错误.虽然 WKWebView 是在 iOS 8 中引入的,但在 -[WKWebView 中存在一个错误initWithCoder:] 仅在 iOS 11 中修复,它总是在运行时崩溃,因此无法在 Interface Builder 中配置.

The error is correct behavior, and not a bug in Xcode 9. Although WKWebView was introduced in iOS 8, there was a bug in -[WKWebView initWithCoder:] that was only fixed in iOS 11, which always crashed at runtime and thus prevented configuring one within Interface Builder.

https://bugs.webkit.org/show_bug.cgi?id=137160

与其让开发人员在 IB 中构建在运行时会被破坏的东西,不如说这是一个构建错误.这是一个不方便的限制,因为 iOS 11 最近才发布,但确实没有其他好的选择.

Rather than allow developers to build something in IB that would be broken at runtime, it is a build error. It's an inconvenient limitation since iOS 11 was only recently released, but there's really no other good option.

旧部署目标的解决方法是继续在代码中添加 WKWebView,正如@fahad-ashraf 在他的回答中已经描述的那样:

The workaround for older deployment targets is to continue to add the WKWebView in code, as @fahad-ashraf already described in his answer:

https://developer.apple.com/documentation/webkit/wkwebview

这篇关于Xcode 9 GM - WKWebView NSCoding 支持在以前的版本中被破坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆