Is there any way to get the JavaScript errors from the WebView? I mean the following errors and possible warnings?
I am running JS code with the following extension:
extension WKWebView {
func evaluateJavaScriptWithReturn(_ javaScriptString: String) -> String? {
var finished = false
var jsValue: String?
evaluateJavaScript(javaScriptString) { (result, error) in
if error == nil {
if result != nil {
jsValue = result as? String
}
} else {
jsValue = nil
}
finished = true
}
while !finished {
RunLoop.current.run(mode: .defaultRunLoopMode, before: Date.distantFuture)
}
return jsValue
}
}
But error is not what I'm looking for!
Is there any way to get in my app, the above errors?
Thanks a lot!
