I have an object which I add to WKWebview's userContentController as a script message handler:
[userContentController addScriptMessageHandler:myScriptMessageHandler name:@"handlerName"];
Now, I can see that the web view deallocates when the view controller it is in gets dismissed. But myScriptMessageHandler does not deallocate. Instruments doesn't pick up a leak either. If I call removeScriptMessageHandlerForName: inside my WKWebview subclasses dealloc method, the script message handler deallocates.
Is there any particular reason why script message handlers wouldn't get destroyed when the WKWebview is deallocated?