Can I run a UIWebView in a seperate thread?

一笑奈何 提交于 2019-12-01 22:17:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!