com.apple.WebKit.WebContent丢失113错误:无法find指定的服务

我正在使用WKWebView查看自定义HTML。

  • 无论HTML内容如何,​​在真实设备上testing时,我收到以下错误Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service WKWebView内容加载后29秒Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service ,有时甚至会收到此错误两次。 显然,这是一个configuration问题。 我已经检查了Cookie,build议在无法发信号服务com.apple.WebKit.WebContent ,但它没有帮助
  • 另一个问题是,是否存在可能在WKWebView中popup的所有错误代码的列表

最后,解决了上面的问题。 我收到错误

  • Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
  • Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service

因为我没有在视图中添加WKWebView对象作为子视图,并试图在它的顶部调用-loadHTMLString:baseURL: 只有在成功加载之后,我才将它添加到查看的子视图中 – 这是完全错误的。 我的问题的正确解决scheme是:

  1. 添加WKWebView对象来查看subviews数组
  2. 调用-loadHTMLString:baseURL:用于最近添加的WKWebView

我得到这个错误加载一个http:// URL,其中服务器回复redirect到https。 更改URL后,我传递给WKWebView https:// …它工作。

当我在iOS 11的WKWebView中加载' http'url时,我也遇到了这个问题。

什么对我来说是设置在info.pist文件中的应用程序传输设置,以允许任意的负载。

 <key>NSAppTransportSecurity</key> <dict> <!--Not a recommended way, there are better solutions available--> <key>NSAllowsArbitraryLoads</key> <true/> </dict>