IOS, This, application, is, the, AutoLayout, engine, a, background, thread, after, the, engine, was, accessed, from, the, main, thread., This, from, can, lead,, to, engine, modifying, corruption, crashes., and, weird

IOS, This, application, is, the, AutoLayout, engine, a, background, thread, after, the, engine, was, accessed, from, the, main, thread., This, from, can, lead,, to, engine, modifying, corruption, crashes., and, weird

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. on the Internet has a lot of, but the solution is not clear as to. Tell me that I should refresh UI when I go back to the main thread, but I don’t know where the problem is, and I don’t know where to return the UI after the main thread.

  • First download PSPDFUIKitMainThreadGuard (it’s just a.M, you’re not mistaken!)
  • Next, break a breakpoint on the PSPDFAssertIfNotMainThread method
IOS, This, application, is, the, AutoLayout, engine, a, background, thread, after, the, engine, was, accessed, from, the, main, thread., This, from, can, lead,, to, engine, modifying, corruption, crashes., and, weird
60AF00CE-9D7D-4A28-84D2-DDAC5C81CA91.png
  • After the error, you can find the root of the error.
    IOS, This, application, is, the, AutoLayout, engine, a, background, thread, after, the, engine, was, accessed, from, the, main, thread., This, from, can, lead,, to, engine, modifying, corruption, crashes., and, weird
    F10B43E3-1631-4FBB-AAD1-776C85F6A1A5.png
  • Finally, you can put the code into the GCD implementation, and put it in OK! Dispatch_async (dispatch_get_main_queue), ^{(UIKit call that had / / Some timing issues but works fine the next runloop. [self / / in updateUI];});