This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.關(guān)于這個(gè)問(wèn)題網(wǎng)上有好多宝剖,但是解決辦法好像給的并不明確憔鬼。告訴我該在回到主線程的時(shí)候刷新UI,然而我并不知道這個(gè)問(wèn)題出現(xiàn)的地方在哪里琳疏,也不知道哪里需要回到主線程后刷新UI粪般。
首先下載PSPDFUIKitMainThreadGuard(它本身就只有一個(gè).m拼余,你沒(méi)有搞錯(cuò)!)
接著在PSPDFAssertIfNotMainThread方法上打個(gè)斷點(diǎn)
60AF00CE-9D7D-4A28-84D2-DDAC5C81CA91.png
-
報(bào)錯(cuò)后你就可以找到錯(cuò)誤根源了
F10B43E3-1631-4FBB-AAD1-776C85F6A1A5.png 最后亩歹,就可以把該放進(jìn)GCD執(zhí)行的代碼放進(jìn)去就OK了匙监!
dispatch_async(dispatch_get_main_queue(), ^{
// Some UIKit call that had timing issues but works fine
// in the next runloop.
[self updateUI];
});