com.apple.WebKit.WebContent drops 113 error: Could not find specified service

IosWebkitWkwebview

Ios Problem Overview


I am using WKWebView for viewing custom HTML.

  • Regardless of HTML content, when testing on real device, I receive the following error Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service in 29 sec after WKWebView content loaded, sometimes I even receive this error twice. Clearly, it is a configuration issue. I have checked cookies as proposed in https://stackoverflow.com/questions/40811887/could-not-signal-service-com-apple-webkit-webcontent, however it doesn't help
  • Another question is whether there exist a list of all error codes that might pop up in WKWebView

Ios Solutions


Solution 1 - Ios

Finally, solved the problem above. I was receiving errors

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

Since I have not added WKWebView object on the view as a subview and tried to call -loadHTMLString:baseURL: on the top of it. And only after it was successfully loaded I was adding it to view's subviews - which was totally wrong. The correct solution for my problem is:

1. Add WKWebView object to view's subviews array

2. Call -loadHTMLString:baseURL: for recently added WKWebView

Solution 2 - Ios

I too faced this problem when loading an 'http' url in WKWebView in iOS 11, it is working fine with https.

What worked for me was setting App transport setting in info.pist file to allow arbitary load.

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

Solution 3 - Ios

Maybe it's an entirely different situation, but I always got WebView[43046:188825] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service when opening a webpage on the simulator while having the debugger attached to it. If I end the debugger and opening the app again the webpage will open just fine. This doesn't happen on the devices.

After spending an entire work-day trying to figure out what's wrong, I found out that if we have a framework named Preferences, UIWebView and WKWebView will not be able to open a webpage and will throw the error above.

To reproduce this error just make a simple app with WKWebView to show a webpage. Then create a new framework target and name it Preferences. Then import it to the main target and run the simulator again. WKWebView will fail to open a webpage.

So, it might be unlikely, but if you have a framework with the name Preferences, try deleting or renaming it.

Also, if anyone has an explanation for this please do share.

BTW, I was on Xcode 9.2.

Solution 4 - Ios

I got this error loading a http:// URL where the server replied with a redirect to https. After changing the URL I pass to WKWebView to https://... it worked.

Solution 5 - Ios

I had this problem I iOS 12.4 when calling evaluateJavascript. I solved it by wrapping the call in DispatchQueue.main.async { }

Solution 6 - Ios

SWIFT

Well I did this in the following order and didn't get any error like Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service after that, following code might help you too.

webView = WKWebView(frame: self.view.frame)
self.view.addSubview(self.view.webView)
webView.navigationDelegate = self
webView.loadHTMLString(htmlString, baseURL: nil)

Do as order.

Thanks

Solution 7 - Ios

In my case I was launching a WKWebView and displaying a website. Then (within 25 seconds) I deallocated the WKWebView. But 25-60 seconds after launching the WKWebView I received this "113" error message. I assume the system was trying to signal something to the WKWebView and couldn't find it because it was deallocated.

The fix was simply to leave the WKWebView allocated.

Solution 8 - Ios

Mine was different again. I was setting the user-agent like so:

    NSString *jScript = @"var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); document.getElementsByTagName('head')[0].appendChild(meta);";
    WKUserScript *wkUScript = [[WKUserScript alloc] initWithSource:jScript injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];

This was causing something on the web page to freak out and leak memory. Not sure why but removing this sorted the issue for me.

Solution 9 - Ios

On OS X, it's necessary to make sure Sandbox capabilities are set-up properly in order to use WKWebView.

This link made this clear to me: https://forums.developer.apple.com/thread/92265

Sharing hoping that it will help someone.


Select the Project File in the Navigator, select Capabilities, then make sure that:

  • App Sandbox is OFF,
    OR
  • App Sandbox is ON AND Outgoing Connections (Client) is checked.

Solution 10 - Ios

Just for others reference, I seemed to have this issue too if I tried to load a URL that had whitespace at the end (was being pulled from user input).

Solution 11 - Ios

Deleting/commenting

- (void)viewWillAppear:(BOOL)animated {[super viewWillAppear:YES];}

function solved the problem for me.

XCode (11.3.1)

Solution 12 - Ios

I tried almost everything, my solution was simple, updating MacOS to the latest version, and also Xcode to the latest version, that way the error was gone, white blank screen was not happening anymore.

Solution 13 - Ios

Just check your URL that you are passing to load request, I was receiving same error when I came to this page, later checked that I was getting URl starting from "www" Later I added "https://" , it works for me

Solution 14 - Ios

Perhaps the below method could be the cause if you've set it to

func webView(_ webView: WebView!,decidePolicyForNavigationAction actionInformation: [AnyHashable : Any]!, request: URLRequest!, frame: WebFrame!, decisionListener listener: WebPolicyDecisionListener!) 

ends with

decisionHandler(.cancel)

for the default navigationAction.request.url

Hope it works!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionIevgenView Question on Stackoverflow
Solution 1 - IosIevgenView Answer on Stackoverflow
Solution 2 - IosAsad KhanView Answer on Stackoverflow
Solution 3 - Iosyusuke024View Answer on Stackoverflow
Solution 4 - IosMarkusView Answer on Stackoverflow
Solution 5 - IosJohn PophamView Answer on Stackoverflow
Solution 6 - IosAbhishek MitraView Answer on Stackoverflow
Solution 7 - IosPeter B. KramerView Answer on Stackoverflow
Solution 8 - IosGuy LoweView Answer on Stackoverflow
Solution 9 - IosJuanmiView Answer on Stackoverflow
Solution 10 - IosDom BarnesView Answer on Stackoverflow
Solution 11 - IossagView Answer on Stackoverflow
Solution 12 - IosmilothView Answer on Stackoverflow
Solution 13 - IosdeepOceanView Answer on Stackoverflow
Solution 14 - IosPradheep Narendran PView Answer on Stackoverflow