<legend id='SZiQQ'><style id='SZiQQ'><dir id='SZiQQ'><q id='SZiQQ'></q></dir></style></legend>

      <bdo id='SZiQQ'></bdo><ul id='SZiQQ'></ul>

      <small id='SZiQQ'></small><noframes id='SZiQQ'>

    1. <tfoot id='SZiQQ'></tfoot>

      <i id='SZiQQ'><tr id='SZiQQ'><dt id='SZiQQ'><q id='SZiQQ'><span id='SZiQQ'><b id='SZiQQ'><form id='SZiQQ'><ins id='SZiQQ'></ins><ul id='SZiQQ'></ul><sub id='SZiQQ'></sub></form><legend id='SZiQQ'></legend><bdo id='SZiQQ'><pre id='SZiQQ'><center id='SZiQQ'></center></pre></bdo></b><th id='SZiQQ'></th></span></q></dt></tr></i><div id='SZiQQ'><tfoot id='SZiQQ'></tfoot><dl id='SZiQQ'><fieldset id='SZiQQ'></fieldset></dl></div>

      在从主线程访问后,不得从后台线程执行对布局引擎的修改

      时间:2023-09-11
      <i id='dYqMz'><tr id='dYqMz'><dt id='dYqMz'><q id='dYqMz'><span id='dYqMz'><b id='dYqMz'><form id='dYqMz'><ins id='dYqMz'></ins><ul id='dYqMz'></ul><sub id='dYqMz'></sub></form><legend id='dYqMz'></legend><bdo id='dYqMz'><pre id='dYqMz'><center id='dYqMz'></center></pre></bdo></b><th id='dYqMz'></th></span></q></dt></tr></i><div id='dYqMz'><tfoot id='dYqMz'></tfoot><dl id='dYqMz'><fieldset id='dYqMz'></fieldset></dl></div>
      <legend id='dYqMz'><style id='dYqMz'><dir id='dYqMz'><q id='dYqMz'></q></dir></style></legend>
          <bdo id='dYqMz'></bdo><ul id='dYqMz'></ul>
          <tfoot id='dYqMz'></tfoot>
            <tbody id='dYqMz'></tbody>

              <small id='dYqMz'></small><noframes id='dYqMz'>

                本文介绍了在从主线程访问后,不得从后台线程执行对布局引擎的修改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                在将现有的 UIViewController 转换为自动布局后,我遇到了这个崩溃,我不知道是什么原因造成的.我确实搜索了 dispatch_async(dispatch_get_global_queue(...)) 调用,但没有更改布局.

                I am getting this crash after converting an existing UIViewController to Auto Layout and I can't figure out what is causing it. I did search for dispatch_async(dispatch_get_global_queue(...)) calls but none changes layout.

                堆栈跟踪也很无用:

                * 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)
                

                有什么方法可以找出触发布局的确切位置吗?

                Is there any way to figure out the exact place that triggered the layout?

                推荐答案

                再次查看堆栈跟踪后,我终于找到了问题所在.问题是我正在后台线程上更改 UISlider 实例的 value 属性.

                I finally found out the problem after taking another look at the stack trace. The problem was that I was changing the value property of a UISlider instance on a background thread.

                但它并没有说明您必须在主线程上更改它!(感谢 Apple)显然,UISlider 似乎实现了 value 的设置器并强制布局或类似的东西.

                But nowhere does it state that you have to change it on the main thread! (Thanks, Apple) Apparently, it seems like UISlider implements the value's setter and forces a layout or something similar.

                这篇关于在从主线程访问后,不得从后台线程执行对布局引擎的修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:UITableView 的自动布局错误 下一篇:如何在不使用代码的情况下使用约束 AutoLayout 来指定横向与纵向的不同布局?

                相关文章

                <small id='uqcRL'></small><noframes id='uqcRL'>

                1. <legend id='uqcRL'><style id='uqcRL'><dir id='uqcRL'><q id='uqcRL'></q></dir></style></legend><tfoot id='uqcRL'></tfoot>

                    <bdo id='uqcRL'></bdo><ul id='uqcRL'></ul>

                    <i id='uqcRL'><tr id='uqcRL'><dt id='uqcRL'><q id='uqcRL'><span id='uqcRL'><b id='uqcRL'><form id='uqcRL'><ins id='uqcRL'></ins><ul id='uqcRL'></ul><sub id='uqcRL'></sub></form><legend id='uqcRL'></legend><bdo id='uqcRL'><pre id='uqcRL'><center id='uqcRL'></center></pre></bdo></b><th id='uqcRL'></th></span></q></dt></tr></i><div id='uqcRL'><tfoot id='uqcRL'></tfoot><dl id='uqcRL'><fieldset id='uqcRL'></fieldset></dl></div>