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.关于这个问题网上有好多,但是解决办法好像给的并不明确。告诉我该在回到主线程的时候刷新UI,然而我并不知道这个问题出现的地方在哪里,也不知道哪里需要回到主线程后刷新UI。
-
首先下载PSPDFUIKitMainThreadGuard(它本身就只有一个.m,你没有搞错!)
-
接着在PSPDFAssertIfNotMainThread方法上打个断点
-
报错后你就可以找到错误根源了
F10B43E3-1631-4FBB-AAD1-776C85F6A1A5.png -
最后,就可以把该放进GCD执行的代码放进去就OK了!
dispatch_async(dispatch_get_main_queue(), ^{
// Some UIKit call that had timing issues but works fine
// in the next runloop.
[self updateUI];
});
网友评论