Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]

问题

今天运行工程的时候,控制台打印了如下的消息:

Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]
PID: 1138, TID: 259096, Thread name: (none), Queue name: 4DDCC0E262F84E829CB2EC0051E6A0A3, QoS: 0

分析

这是Main Thread Checker检测到了[UIApplication delegate]没有运行在主线程中,只要将[UIApplication delegate]添加到主线程中即可解决问题

疑问

[UIApplication delegate]为啥要运行在主线程,是因为[UIApplication delegate]中有window的原因?

你可能感兴趣的:(Main Thread Checker: UI API called on a background thread: -[UIApplication delegate])