26

I have a simple WKWebView in a UIViewController container in the application. User will open this UIViewController container with WKWebView, and then will eventually close it with navigation "Back" item. The navigation item disposes container and WKWebView. It works, but on every closure I see the following errors in the log:

First pair of errors:

[assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}>

[ProcessSuspension] 0x7f8f9d404210 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 27176, error: Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}

Second pair of errors:

[assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}>

[ProcessSuspension] 0x7f8f9d005c30 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 27176, error: Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}

Third pair of errors:

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

The WKWebView is disposed from container UIViewController's viewDidDisappear (also tried to move it to viewWillDisappear, which made no difference) in the following way:

webView.stopLoading()
webView.configuration.userContentController.removeScriptMessageHandler(forName: "...")
webView.navigationDelegate = nil
webView.scrollView.delegate = nil
webView = nil

There's no negative side effects of those errors it seems. But I want to understand: am I missing some cleanup on WKWebView disposal? Why does it try to "enter background"?

timbre timbre
  • 12,648
  • 10
  • 46
  • 77
  • I am getting the same set of errors, but I get them when I click on a link in the WKWebView that has a custom url scheme that my WKWebView is looking for using WKWebViewConfiguration().setURLSchemeHandler(...) I tried adding background processing via the Capabilities section in my Xcode project, but that had no change on the errors. – kdbdallas Dec 09 '20 at 21:02
  • I have a similar issue on iPhone 11 PRO and iPhone 11 Mini when using a Cordova app. See following issue for more info: https://stackoverflow.com/questions/67571345/ios-iphone-11-flashing-black-and-white-while-browsler-is-constantly-reloading-r – Marcel Schürmann May 17 '21 at 14:11
  • @MarcelSchürmann in my case those were just warnings. So far we didn't see any side effects they caused or anything like that... – timbre timbre May 31 '21 at 22:10
  • @ytrewq Did you get to fix this? I'm almost suffering form the exact same thing – Ryuga Law Mar 28 '22 at 13:20
  • Got here after integrating IronSource SDK to Unity. The same set of warnings. – Anton Kasabutski Jun 25 '23 at 01:05

1 Answers1

10

I am facing same issues and found these two interesting threads:

  1. https://developer.apple.com/forums/thread/112095 where a guy from Apple's support claims that these warnings (e.g. Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service) aren't something you should worry about
  2. Xcode 8, iOS 10 - "Starting WebFilter logging for process" this was the only solution that helped me silence these warnings. Basically, you should set OS_ACTIVITY_MODE = disable
Ivan
  • 103
  • 4