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 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
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 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>
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.
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 had this problem I iOS 12.4 when calling evaluateJavascript. I solved it by wrapping the call in DispatchQueue.main.async { }
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
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.
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.
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.
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!
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).
Deleting/commenting
- (void)viewWillAppear:(BOOL)animated {[super viewWillAppear:YES];}
function solved the problem for me.
XCode (11.3.1)
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.
I'm using an iPhone App that has some important information on it, but I also figured out that it uses a webview. And I'm not sure if it's safe; like; is it over https? What URL is being called?
Is there a way you can find out what Website is being called in the webview? Like you can do inspect element when using Safari from OSX with usb-connected iPhone.
UIWebview works for any url you call it with. If your site is https, the communication will be encrypted. Not all requests on UIWebView are not https. You can't inspect element from iPhone/iPad/Simulator. You can do it in web in the mobile view (by using useragent).
I found a lot of tutorials about opening an app by a custom url scheme like:
myappname://
Thats nice but it would be great to open an app by registering the real app domain over the http link like
http://www.myappdomain.com/blablabla
So - for example - if a visitor comes to a webpage (on her/his mobile) it is normally opened in the browser, excepts the installed app is listening to the opened URL and opens itself instead of the browser.
How is this done (i've seen this at another app). Any help would be great. Thanks in advance!
It is a new feature in iOS9. It is explained in the WWDC15 talk Seamless linking to your App.
You could also add a small piece of javascript to each page that opens your custom URL-scheme.
I'm using PhoneGap with AngularJS framework.
I want to display a web page. I tried to use iframe but scroll isn't working.
I want to keep this page inside my app and not as a in app browser or external browser.
My app is running on iOS, Android and WP8 both.
Some help please :)
Thanks in advance
function loadWebView(pid)
{
var url = "http://dummysite.com/index.php/catalog/product/view/id/"+pid;
$("#div_load_page").html('<object data='+url+' class="webview"/>');
};
This is simple jQuery I've applied in my phonegap application which gives me the desired result. Scroll bars are visible and depend on site's responsiveness and size.
See Result.
I am running into a situation which I am not sure is possible from technical/design point of view. Please advise.
Here is what I need:
I have an open URL registered for my native iOS app. I expect a request ID to be passed along with it and once hit I open that request.
From within my native iOS app, I need to open a web page in the webview. This page has few buttons in it.
A tap on the button in the webview should open the request inside my app. So, I want to trigger the registered open URL in step #1.
Web page data is dynamic and will change on the fly.
Is this a feasible design. Shall I consider something else.
Any advise/pointers will be appreciated.
This should be possible. Here's a though:
1: Implement the UIWebview delegate method shouldStartLoadWithRequest.
2: when you intercept that your webview is attempting to access the url yourapp://blah-blah-blah you can return NO instead dip into your appdelegate can manually call the function handleOpenURL.
I've seen something similar in the past with supporting oAuth (I believe it was with instagram) within one of our apps. We basically loaded up the login page in a UIWebview and then when we detected the the post login redirect we parsed the oAuth token from the url and called it good.
Good luck