问题
I have a web-view running JavaScript application, and sometimes it freezes/hangs when the main thread are performing heavier jobs like xhr calls and initializing video player. Is it possible to run a UIWebView in a separate thread, to avoid the web-view from being blocked?
回答1:
UIWebView may make calls to UIKit which is in the main thread. Placing it in a separate thread will likely cause a crash. You can't create views on background threads, that's UI stuff. As Paul said in the comment, your best bet is to move anything else tying up the main thread into its own queue.
来源:https://stackoverflow.com/questions/11139509/can-i-run-a-uiwebview-in-a-seperate-thread