panghaijiao/HJDanmakuDemo

Main Thread Checker: UI API called on a background thread: -[UIView bounds]

Closed this issue · 6 comments

=================================================================
Main Thread Checker: UI API called on a background thread: -[UIView bounds]
PID: 47922, TID: 605990, Thread name: (none), Queue name: com.olinone.danmaku.renderQueue, QoS: 0
Backtrace:
4 HJDanmaku 0x0000000110740205 -[HJDanmakuView layoutPyWithLRDanmaku:forTime:] + 213
5 HJDanmaku 0x000000011074007c -[HJDanmakuView layoutPyWithNewDanmaku:forTime:] + 220
6 HJDanmaku 0x000000011073fd84 -[HJDanmakuView layoutNewDanmaku:forTime:] + 436
7 HJDanmaku 0x000000011073eec5 -[HJDanmakuView renderNewDanmaku:forTime:] + 85
8 HJDanmaku 0x000000011073ec6c -[HJDanmakuView renderNewDanmakusForTime:] + 1948
9 HJDanmaku 0x000000011073d9f7 __49-[HJDanmakuView renderDanmakusForTime:buffering:]_block_invoke + 103
10 libdispatch.dylib 0x00000001175583f7 _dispatch_call_block_and_release + 12
11 libdispatch.dylib 0x000000011755943c _dispatch_client_callout + 8
12 libdispatch.dylib 0x000000011756195b _dispatch_queue_serial_drain + 1162
13 libdispatch.dylib 0x00000001175622df _dispatch_queue_invoke + 336
14 libdispatch.dylib 0x000000011755e07d _dispatch_queue_override_invoke + 733
15 libdispatch.dylib 0x00000001175651f9 _dispatch_root_queue_drain + 772
16 libdispatch.dylib 0x0000000117564e97 _dispatch_worker_thread3 + 132
17 libsystem_pthread.dylib 0x0000000117a1c5a2 _pthread_wqthread + 1299
18 libsystem_pthread.dylib 0x0000000117a1c07d start_wqthread + 13

控制台输出了这些

看提示是说子线程调用了UI操作,你们项目中是不是集成了UI check工具,你可以试着在check函数里面把这个报警函数先过滤掉,后面我把这个地方优化下

这里只是在子线程读了UIView的bounds,不影响的

O(∩_∩)O谢谢
这个Main Thread Checker是xcode9的自带提示

哦,我是说了,还没有升级xcode9,不影响你使用的

刚才更新了2.0.1版本,解决了改线程问题