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

查看:2167
本文介绍了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中的错误。尽管在iOS 8中引入了WKWebView,但是存在一个错误WKWebView仅在iOS 11中修复,它在运行时始终在 -initWithCoder:上崩溃,因此无法在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 that was only fixed in iOS 11, which always crashed on -initWithCoder: at runtime and thus prevented configuring one within Interface Builder.

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

而不是允许开发人员b在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天全站免登陆