“This application is modifying the autolayout engine from a background thread”

自闭症网瘾萝莉.ら 提交于 2019-12-04 14:38:36

Let's identify exact execution path which leads to auto layout engine corruption. For this you need to add symbolic breakpoint to following:

+[NSException raise:format:]

You can do this following way:

Then:

After that once your app get stuck on the breakpoint, please grab and share the stack trace. You can do this using lldb console:

(lldb) bt
* thread #4: tid = 0x2bbc48, 0x000000010ba5ebf0 CoreFoundation`+[NSException raise:format:], queue = 'com.apple.root.default-qos', stop reason = breakpoint 1.1
  * frame #0: 0x000000010ba5ebf0 CoreFoundation`+[NSException raise:format:]
    frame #1: 0x0000000108dd5b6b Foundation`_AssertAutolayoutOnMainThreadOnly + 79
    frame #2: 0x0000000108dd5a62 Foundation`-[NSISEngine _optimizeWithoutRebuilding] + 49
    frame #3: 0x0000000108c34c0f Foundation`-[NSISEngine optimize] + 46
    frame #4: 0x0000000108c3b875 Foundation`-[NSISEngine constraintDidChangeSuchThatMarker:shouldBeReplacedByMarkerPlusDelta:] + 313
    frame #5: 0x0000000108c3b6f2 Foundation`-[NSISEngine tryToChangeConstraintSuchThatMarker:isReplacedByMarkerPlusDelta:undoHandler:] + 440
    frame #6: 0x0000000108c27715 Foundation`-[NSLayoutConstraint _tryToChangeContainerGeometryWithUndoHandler:] + 484
    frame #7: 0x0000000108c27274 Foundation`-[NSLayoutConstraint _setSymbolicConstant:constant:] + 422
    frame #8: 0x0000000108ac35d5 iosapp`ViewController.(self=0x00007fe86a6abc80) -> ()).(closure #1) + 133 at ViewController.swift:26
    frame #9: 0x0000000108ac3627 iosapp`thunk + 39 at ViewController.swift:0
    frame #10: 0x000000010c775d9d libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #11: 0x000000010c7963eb libdispatch.dylib`_dispatch_client_callout + 8
    frame #12: 0x000000010c77eb2f libdispatch.dylib`_dispatch_root_queue_drain + 1829
    frame #13: 0x000000010c77e405 libdispatch.dylib`_dispatch_worker_thread3 + 111
    frame #14: 0x000000010cad34de libsystem_pthread.dylib`_pthread_wqthread + 1129
    frame #15: 0x000000010cad1341 libsystem_pthread.dylib`start_wqthread + 13
(lldb) 

Once you've done this, we can identify exact place which causes the issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!