当我从核心数据中检索项目并更新UIListView时运行我的应用程序时,我收到以下错误。
2016-02-22 15:51:15.420 MyListApp[10909:480716] This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.
Stack:(
0 CoreFoundation 0x000000010dca0e65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000011017edeb objc_exception_throw + 48
2 CoreFoundation 0x000000010dca0d9d +[NSException raise:format:] + 205
3 Foundation 0x000000010e4bd285 _AssertAutolayoutOnMainThreadOnly + 79
4 Foundation 0x000000010e31d432 -[NSISEngine optimize] + 49
5 Foundation 0x000000010e31dcf4 -[NSISEngine withBehaviors:performModifications:] + 245
6 UIKit 0x000000010f52a1ca -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 58
7 UIKit 0x000000010f52ab4c -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:forSecondPass:] + 154
8 UIKit 0x000000010f52a7bc -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:forSecondPass:] + 309
9 UIKit 0x000000010f52ab78 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:forSecondPass:] + 198
10 UIKit 0x000000010f52b1b0 __60-[UIView(AdditionalLayoutSupport) updateConstraintsIfNeeded]_block_invoke + 98
11 UIKit 0x000000010f52a1d3 -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 67
12 UIKit 0x000000010f52ad0d -[UIView(AdditionalLayoutSupport) updateConstraintsIfNeeded] + 254
13 UIKit 0x000000010f52ba22 -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeeded] + 272
14 UIKit 0x000000010ed0259e -[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 159
15 UIKit 0x000000010ed124cc -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 744
16 QuartzCore 0x000000010eb1759a -[CALayer layoutSublayers] + 146
17 QuartzCore 0x000000010eb0be70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
18 QuartzCore 0x000000010eb0bcee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
19 QuartzCore 0x000000010eb00475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
20 QuartzCore 0x000000010eb2dc0a _ZN2CA11Transaction6commitEv + 486
21 QuartzCore 0x000000010eb2defc _ZN2CA11Transaction14release_threadEPv + 224
22 libsystem_pthread.dylib 0x0000000110fa814c _pthread_tsd_cleanup + 470
23 libsystem_pthread.dylib 0x0000000110fa7d28 _pthread_exit + 117
24 libsystem_pthread.dylib 0x0000000110fa8733 pthread_get_stackaddr_np + 0
25 libsystem_pthread.dylib 0x0000000110fa6365 start_wqthread + 13
)
我正在努力弄清楚如何找出导致此错误的原因。我很确定如何在找到导致它的代码后如何解决问题,但是堆栈跟踪除了告诉我某些东西导致修改自动布局约束外,并没有真正帮助我。 Xcode中是否还有其他工具可以帮我解决这个问题,或者堆栈跟踪中有什么东西我没看到?
谢谢!