在NCE
(通知内容扩展)中,我使用 a WKWebView
,它加载本地和远程内容
然而,当手机被锁定时,该方法
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!)
永远不会被叫,也
func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error)
func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error)
不会因任何错误而被调用
webview 在加载时卡住了......但是当手机解锁时,一切都按预期工作
这是一个错误,还是有意的?如何避免这种情况,或检测到这个问题
手机锁定时激活 NCE 期间的控制台输出
2021-10-01 12:12:25.737559+0200 Minuta-NCE[4223:493144] [Process] 0x1022ce100 - [PID=4253] WebProcessProxy::didClose: (web process 4253 crash)
2021-10-01 12:12:25.737619+0200 Minuta-NCE[4223:493144] [Process] 0x1022ce100 - [PID=4253] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=3
2021-10-01 12:12:25.737726+0200 Minuta-NCE[4223:493144] [Process] 0x101824c18 - [pageProxyID=69, webPageID=70, PID=4253] WebPageProxy::processDidTerminate: (pid 4253), reason 3
2021-10-01 12:12:25.739596+0200 Minuta-NCE[4223:493144] [Loading] 0x101824c18 - [pageProxyID=69, webPageID=70, PID=4253] WebPageProxy::dispatchProcessDidTerminate: reason=3
2021-10-01 12:12:25.739746+0200 Minuta-NCE[4223:493144] [Process] 0x101824c18 - [pageProxyID=69, webPageID=70, PID=4253] WebPageProxy::tryReloadAfterProcessTermination: process crashed and the client did not handle it, not reloading the page because we reached the maximum number of attempts
2021-10-01 12:12:25.740206+0200 Minuta-NCE[4223:494960] [assertion] 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}>
2021-10-01 12:12:25.741077+0200 Minuta-NCE[4223:494960] [ProcessSuspension] 0x1022f9980 - ProcessAssertion: Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=4253, error: 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}
2021-10-01 12:12:25.742912+0200 Minuta-NCE[4223:494960] [assertion] 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}>
2021-10-01 12:12:25.742953+0200 Minuta-NCE[4223:494960] [ProcessSuspension] 0x1022f99e0 - ProcessAssertion: Failed to acquire RBS assertion 'WebProcess Background Assertion' for process with PID=4253, error: 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}
2021-10-01 12:12:25.746129+0200 Minuta-NCE[4223:494960] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}>
2021-10-01 12:12:25.746167+0200 Minuta-NCE[4223:494960] [ProcessSuspension] 0x1022f9aa0 - ProcessAssertion: Failed to acquire RBS assertion 'WebProcess Background Assertion' for process with PID=4253, error: Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}
2021-10-01 12:12:25.746444+0200 Minuta-NCE[4223:494960] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}>
2021-10-01 12:12:25.747201+0200 Minuta-NCE[4223:494960] [ProcessSuspension] 0x1022f9b00 - ProcessAssertion: Failed to acquire RBS assertion 'WebProcess Suspended Assertion' for process with PID=4253, error: Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}
但如前所述,遗憾的是代码中没有返回错误