My ViewController has a WKWebView that embeds JavaScript with a video.
When I pop the view controller, deinit is called. In deinit, I nullify everything that related to webView.
However, after popping the view controller, the audio from the video is still playing. What am I missing?
deinit
{
webView.removeObserver(self, forKeyPath: "estimatedProgress")
webView.navigationDelegate = nil
webView.scrollView.delegate = nil
webView.removeFromSuperview()
webView = nil
}
I am sure it is because of some cycled retains of the webView. Try by setting empty data to webview in 'deinit'. This may solve your problem, but you have to fix cycled retain of your webview.
webView.loadRequest(NSURLRequest(URL: NSURL(string: "about:blank")))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With