6
Xcode 9似乎報告了很多主線程調用UIApplication屬性。即使UI沒有被更新,由於日誌的擴展,它會產生一個默認環境,這特別麻煩。主線程檢查器:在後臺線程上調用UI API: - [UIApplication delegate]
4 TestApp 0x0000000101c262e0 __39-[ViewController viewDidLoad]_block_invoke + 196
5 libdispatch.dylib 0x0000000102279654 _dispatch_call_block_and_release + 24
6 libdispatch.dylib 0x0000000102279614 _dispatch_client_callout + 16
7 libdispatch.dylib 0x0000000102289008 _dispatch_queue_serial_drain + 716
8 libdispatch.dylib 0x000000010227ce58 _dispatch_queue_invoke + 340
9 libdispatch.dylib 0x000000010228a1c4 _dispatch_root_queue_drain_deferred_wlh + 412
10 libdispatch.dylib 0x00000001022917fc _dispatch_workloop_worker_thread + 868
11 libsystem_pthread.dylib 0x00000001ac6771e8 _pthread_wqthread + 924
12 libsystem_pthread.dylib 0x00000001ac676e40 start_wqthread + 4
你我們忽略了這個堆棧跟蹤的頂部,它會告訴我們這是在哪個線程上運行。我敢打賭,這不是主線。例如,如果您從後臺線程啓動segue(例如'URLSession'完成關閉),'viewDidLoad'也不在主線程中。您需要追溯以查看啓動過渡的位置,並確認它在主線程中。或者,如果你真的在主線程上運行它時,我們需要看到最少量的代碼,它允許我們[重現日誌消息](http://stackoverflow.com/help/) MCVE)。 – Rob