weiyin weiyin - 3 months ago 38
iOS Question

What thread does the completionHandler of WKWebView's evaluateJavascript method run on?

I am trying to figure out if it is safe to manipulate UI objects in the completion handler of WKWebView's

- evaluateJavaScript:completionHandler:
. The docs do not seem to specify.


It does not matter. If it is not specified then you should assume that it is not.

You can very easily run your UI code on the main thread using:

dispatch_async(dispatch_get_main_queue(), ^{
    // Your UI code here

Better safe than sorry.