My view controller displays a WKWebView. I installed a message handler, a cool Web Kit feature that allows my code to be notified from inside the web page:
o
I've also noted that you also need to remove the message handler(s) during teardown, otherwise the handler(s) will still live on (even if everything else about the webview is deallocated):
WKUserContentController *controller =
self.webView.configuration.userContentController;
[controller removeScriptMessageHandlerForName:@"message"];