不管 HTML 内容如何,在实际设备上测试时,在加载 WKWebView内容后的29秒内,我会收到以下错误 Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service,有时我甚至会收到两次这样的错误。显然,这是一个配置问题。我已经检查了在 无法通知服务 com.apple. WebKit. WebContent中建议的 cookie,但是它没有帮助
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
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.
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>
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.
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.
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.
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.
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.
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
For those who use flutter, I get the same error on webview_flutter, flutter_inappwebview and flutter_webview_plugin which I thought its from the package so I tried different things. However, in my case I was trying to open customer scheme URL to use it to open the app which is something like appname://code=xxx... and the WKWebView won't allow you to open it, but on Android it will be opened but you'll get some error message.
It was working fine on flutter_webview_plugin cause it does provider onUrlChange listener which will intercept the call before loading it and allow you to do what you want with it... for me, I closed the webview and used url_luncher.
To do the same thing on webview_flutter you should use the navigationDelegate option to allow opening the URL or not, as follows:
WebView(
javascriptMode: JavascriptMode.unrestricted,
initialUrl: url,
navigationDelegate: (x) {
if(x.url.toString().toLowerCase().startsWith('appname://')){
//close webview and do something
// prevent open the url
return NavigationDecision.prevent;
}
else return NavigationDecision.navigate;
},
For flutter_inappwebview there is an option they mention on the official doc
... I didn't try it cause webview_flutter did work... but I suppose it does the same thing
resourceCustomSchemes: List of custom schemes that the WebView must handle. Use the WebView.onLoadResourceCustomScheme event to intercept resource requests with custom scheme.