objective c renderInContext crash on background thread

非 Y 不嫁゛ 提交于 2019-12-03 16:41:01

-renderInContext: is not thread-safe and you can't call it from a background thread. You'll have to do the drawing on the main thread.

I had nothing to do but performing this method on main thread. I reorganized my thread management and could get good result for me doing this:

[self performSelectorOnMainThread:@selector(captureScreenOnMainThread) withObject:nil waitUntilDone: YES]; Last parameter can be set to no in some cases...

Thanks for all responses.

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