Click here to Skip to main content
15,887,875 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I want to support two way communication in Xamarin.iOS hybrid application.

For that I need access to js context which is not supported in wkWebView.

The below code is working in UIWebView but not in WKWebView.

var context = (JSContext)WebView.ValueForKeyPath((NSString)"documentView.webView.mainFrame.javaScriptContext");

var myExporter = new MyJSExporter();
context[(NSString)"myCSharpAPIs"] = JSValue.From(myExporter, context);

WebView.LoadRequest(NSUrlRequest.FromUrl(new NSUrl("app.html", false)));

Please suggest me any alternate way to achieve this.

What I have tried:

It is working in UIWebView
But I need to implement it in WKWebView
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900