Not sure if I hit a bug in WebKit or I am doing something horribly wrong, but I can\'t figure out how to use WKScriptMessageHandler without causing wha
You've got a retain cycle here. In your code, ViewController retains WKWebView, WKWebView retains WKWebViewConfiguration, WKWebViewConfiguration retains WKUserContentController and your WKUserContentController retains your ViewController. Just like in comment above, you have to remove scriptHandler by calling removeScriptMessageHandlerForName, before closing your view controller.