我已将我的设备更新至 iOS 16.1。现在我的实时应用程序没有响应 webview。我已经使用 WKWebView 并尝试加载 URL。它根本没有反应。
这是代码:
let link = URL(string:"company URL")!
let myRequest = URLRequest(url: link)
webView.load(myRequest)
这就是我遇到的问题
[pageProxyID=6, webPageID=7, PID=18450] WebPageProxy::tryReloadAfterProcessTermination: process crashed and the client did not handle it, not reloading the page because we reached the maximum number of attempts
Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
根本没有加载。
以下是苹果的回应:
感谢您联系开发者技术支持。 DTS工程师有 审查了此请求并确定这是 WKWebView 中的错误。
解决方案如下:
func makeViewConfiguration() -> WKWebViewConfiguration
{
let configuration = WKWebViewConfiguration()
let dropSharedWorkersScript = WKUserScript(source: "delete window.SharedWorker;", injectionTime: WKUserScriptInjectionTime.atDocumentStart, forMainFrameOnly: false)
configuration.userContentController.addUserScript(dropSharedWorkersScript)
return configuration
}
var view = WKWebView(frame: CGRect(x: 0, y: 0, width: 400, height: 400), configuration: makeViewConfiguration())
让我知道这是否有效。
编码快乐!