I use the following JavaScript code inside a WKWebView:
[webView evaluateJavaScript:@"document.getElementsByClassName('blog-background overlay text-center align-middle animated from-top animation-on')[0].style.display = 'NONE'" completionHandler:^(id _Nullable sha, NSError * _Nullable error) {
NSLog(@"%@", error);
}];
I get this error:
Error Domain=WKErrorDomain Code=4 "A JavaScript exception occurred" UserInfo={NSLocalizedDescription=A JavaScript exception occurred}
How can I solve the problem?