Error : Could not signal service com.apple.WebKit.Networking in iOS

Dinesh_OfficialDinesh_Official Member ✭✭
edited January 15 in Xamarin.iOS

Hello,

In my application, i have used the WKWebView to generate the PDF from HTML string. Please refer the below code example

WKWebView webView = new WKWebView(new CGRect(0, 0, (int)PageWidth, (int)PageHeight), new WKWebViewConfiguration());
webView.UserInteractionEnabled = false;
webView.BackgroundColor = UIColor.White;
webView.NavigationDelegate = new CustomDelegate(completionsource, path, (int)PageWidth, (int)PageHeight);
webView.LoadHtmlString(html, null);

Custom Delegate :

public class CustomDelegate : WKNavigationDelegate
{
    public CustomDelegate(TaskCompletionSource<bool> completionsource, string _filepath, double _pageWidth, double _pageHeight)
    {
     
    }

    public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation)
    {
          //Not triggering 
    }         
}

When the application is deployed, it navigates to the CustomDelegate class but the DidFinishNavigation override is not triggered.

In the output window, i am getting the below error.

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

Can anyone please suggest me on this?

Note :
1. I don't want to add the WkWebView into any view .
2. DidFinishNavigation triggers when application is first time deployed and whenever i restart the machine.

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    Refer the solution for solved the Could not find specified service error .

    Add WkWebView into view first and then call LoadHtmlString method .

    1. I don't want to add the WkWebView into any view .

    Where we can see the WkWebView if you don't add it into any view ?

  • Dinesh_OfficialDinesh_Official Member ✭✭
    edited January 15

    @ColeX , For example, in a button event i am generating/creating a html from an API and want to convert those html string to PDF. And directly save the PDF file into my location.

    Here i don't need to add the WKWebView to any view.

    Also, please note the method raises whenever i restart the machine.

  • ColeXColeX Member, Xamarin Team Xamurai
    edited January 16

    Override the method DidFailNavigation to see if it triggers as expected when DidFinishNavigation not trigger.

  • Dinesh_OfficialDinesh_Official Member ✭✭

    @ColeX , i tried that but DidFailNavigation method is not raising.

  • ColeXColeX Member, Xamarin Team Xamurai

    Could you provide a mini , basic sample project to us for reproducing the issuse ?

    Just zip it and attach on the forum , remove your personal information in project .

Sign In or Register to comment.