diff --git a/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m b/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m index 6b9409bfe..948c2f4b8 100644 --- a/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m +++ b/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m @@ -273,6 +273,14 @@ - (void)pluginInitialize NSLog(@"Using WKWebView"); } +- (void)dispose +{ + WKWebView* wkWebView = (WKWebView*)_engineWebView; + [wkWebView.configuration.userContentController removeScriptMessageHandlerForName:CDV_BRIDGE_NAME]; + + [super dispose]; +} + - (void) onAppWillEnterForeground:(NSNotification*)notification { if ([self shouldReloadWebView]) { NSLog(@"%@", @"CDVWebViewEngine reloading!");