Open Gjworks opened 7 years ago
I also have the same question. I also want his solution for WKWebView
Hi, I am trying to use the library with WKWebView, and I encounter a problem with the jsinterface configuration callback not being called. Any idea on how to make this library work with WKWebView?
I'm trying to create a WKWebView based version, did you find a way to make it work?
@mureatencio No, I wasn't able to make it work. I had to use userContentController
let contentController = WKUserContentController()
contentController.add(self, name: "configureNotifications")
// Webview setup
let webConfiguration = WKWebViewConfiguration()
webConfiguration.userContentController = contentController
And then implement the "delegate":
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
if message.name == "configureNotifications" {
// do your magic
}
}
HELLO :) iOS 11 version and swift4 WKWebView addJavascriptInterface How do I update?