Error when tapping on anything inside loaded page in WKWebview

I have an issue with WKWebview. The pages load without any problems, but whenever I tap on any button on website, slide photos or accept cookies policy I get the following error:

2019-10-14 11:27:02.933458+0200 AppTitle[2592:447958] [general] Connection to daemon was invalidated

Does anyone know what may be the issue or what am I missing? This error causes further problems inside the app. Here is my code:


import UIKit
import WebKit
import TinyConstraints
class DetailsVC: UIViewController, WKNavigationDelegate, WKUIDelegate {
let myUrl = URL(string: "https://google.pl/")
var webView: WKWebView = {
let webview = WKWebView()
return webview
}()
func addWebView() {
view.addSubview(webView)
webView.edgesToSuperview(insets: .top(40) + .right(0) + .left(0), usingSafeArea: true)
webView.navigationDelegate = self
webView.uiDelegate = self
webView.load(URLRequest(url: self.myUrl!))
}
override func viewDidLoad() {
super.viewDidLoad()
// Add webview
addWebView()
}
}

I have the same or a very similar issue on an Objective C codebase. I suspect that after the error message appears, input events to the associated UIView are being dropped. Were you able to identify a root cause or a workaround?

h ttps://forums.raywenderlich.com/t/your-first-ios-app-43-wkwebview/77031/2


proposes an explanation (could not check) to the loss of connection:

The ‘processAssertionWasInvalidated’ comes after the ‘WKWebView’ object is released from memory. Retaining a reference (for example, by reusing the view controller that contains it instead of creating a new one) avoids this warning. Apparently something is trying to communicate with web view and has not been told it has been released.

Error when tapping on anything inside loaded page in WKWebview
 
 
Q