0
在將現有的UIViewController
轉換爲自動佈局後,我收到了此崩潰,我無法弄清楚是什麼導致了它。我確實搜索了dispatch_async(dispatch_get_global_queue(...))
調用,但沒有更改佈局。在從主線程訪問佈局引擎後,不得從後臺線程執行修改
堆棧跟蹤也很無助:
* thread #18: tid = 0x73617, 0x0000000183aa8524 libobjc.A.dylib`objc_exception_throw, stop reason = breakpoint 3.1
* frame #0: 0x0000000183aa8524 libobjc.A.dylib`objc_exception_throw
frame #1: 0x0000000185071100 CoreFoundation`+[NSException raise:format:] + 116
frame #2: 0x0000000185c83894 Foundation`_AssertAutolayoutOnAllowedThreadsOnly + 192
frame #3: 0x0000000185c835d4 Foundation`-[NSISEngine _optimizeWithoutRebuilding] + 76
frame #4: 0x0000000185aceddc Foundation`-[NSISEngine optimize] + 112
frame #5: 0x0000000185c82270 Foundation`-[NSISEngine performPendingChangeNotifications] + 112
frame #6: 0x000000018af23e18 UIKit`-[UIView(Hierarchy) layoutSubviews] + 220
frame #7: 0x000000018b15fff8 UIKit`-[UISlider layoutSubviews] + 192
frame #8: 0x000000018af23a80 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1196
frame #9: 0x00000001883d19d8 QuartzCore`-[CALayer layoutSublayers] + 148
frame #10: 0x00000001883c64cc QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 292
frame #11: 0x00000001883c638c QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
frame #12: 0x00000001883433e0 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 252
frame #13: 0x000000018836aa68 QuartzCore`CA::Transaction::commit() + 512
frame #14: 0x000000018836af34 QuartzCore`CA::Transaction::release_thread(void*) + 660
frame #15: 0x0000000184103fbc libsystem_pthread.dylib`_pthread_tsd_cleanup + 572
frame #16: 0x0000000184103ce4 libsystem_pthread.dylib`_pthread_exit + 200
frame #17: 0x0000000184103378 libsystem_pthread.dylib`_pthread_wqthread + 1504
frame #18: 0x0000000184102d8c libsystem_pthread.dylib`start_wqthread + 4
(lldb)
有什麼辦法找出觸發佈局的確切地點?
'這是你的主線程衝突或任何其他進程中斷主線程,請致電您在側盛大dispatch' dispatch_after方法(時間,dispatch_get_main_queue(){ }) –
你做一些動畫在後臺線程。 – Sergey
@Sergey,我不認爲這是問題,因爲如果是這樣的話,他們也不會在自動佈局之前工作。 –