当我更新Xcode7时,我收到了这条消息。你能告诉我解决方案吗?感谢。
此应用程序正在从后台线程修改autolayout引擎,这可能导致引擎损坏和奇怪的崩溃。这将在将来的版本中引发异常。
Stack:(
0 CoreFoundation 0x250df883 <redacted> + 150
1 libobjc.A.dylib 0x367dedff objc_exception_throw + 38
2 CoreFoundation 0x250df7b1 <redacted> + 0
3 Foundation 0x25f7be63 <redacted> + 170
4 Foundation 0x25e21ba7 <redacted> + 38
5 UIKit 0x292f3aa9 <redacted> + 52
6 UIKit 0x292f4487 <redacted> + 222
7 UIKit 0x299ccfa5 <redacted> + 288
8 UIKit 0x294e5fa9 <redacted> + 148
9 UIKit 0x291ed6bb <redacted> + 694
10 QuartzCore 0x28ab967d <redacted> + 128
11 QuartzCore 0x28ab4d79 <redacted> + 352
12 QuartzCore 0x28ab4c09 <redacted> + 16
13 QuartzCore 0x28ab4129 <redacted> + 368
14 QuartzCore 0x28ab3deb <redacted> + 590
15 WebCore 0x34a9c79f <redacted> + 282
16 CoreFoundation 0x250a2827 <redacted> + 14
17 CoreFoundation 0x250a2417 <redacted> + 454
18 CoreFoundation 0x250a077f <redacted> + 806
19 CoreFoundation 0x24ff31e9 CFRunLoopRunSpecific + 516
20 CoreFoundation 0x24ff2fdd CFRunLoopRunInMode + 108
21 WebCore 0x34040cdf <redacted> + 422
22 libsystem_pthread.dylib 0x37077c93 <redacted> + 138
23 libsystem_pthread.dylib 0x37077c07 _pthread_start + 110
24 libsystem_pthread.dylib 0x37075a24 thread_start + 8
)
答案 0 :(得分:16)
我不知道你的代码是什么,但我知道为什么会这样。您必须在后台线程中完成一些UI更改。
除了主线程之外,不要更改UI,它必然会被绑定 使您的应用程序不稳定,并且无法预测崩溃。
您可以从任何线程监听并执行工作,并在dispatch_async中封装UI更改:
dispatch_async(dispatch_get_main_queue(), ^{
// Do UI stuff here
});