Xcode7: 此应用程序正在从后台线程修改自动布局引擎,这可能会导致引擎损坏和奇怪的崩溃
Xcode7: This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes
我在更新 Xcode7 时收到了这条消息。你能告诉我解决办法吗?谢谢
此应用程序正在从后台线程修改自动布局引擎,这可能会导致引擎损坏和奇怪的崩溃。这将在未来的版本中导致异常。
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
)
我不知道你的代码是什么,但我知道为什么会这样。您必须在后台线程中进行一些 UI 更改。
Do not change UI from anything but the main thread, it is bound to
make your application unstable, and crash unpredictably.
使用 GCD(Grand Central Dispatch)。
您可以从任何线程收听和工作,并将 UI 更改封装在 dispatch_async:
dispatch_async(dispatch_get_main_queue(), ^{
// Do UI stuff here
});
我在更新 Xcode7 时收到了这条消息。你能告诉我解决办法吗?谢谢
此应用程序正在从后台线程修改自动布局引擎,这可能会导致引擎损坏和奇怪的崩溃。这将在未来的版本中导致异常。
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
)
我不知道你的代码是什么,但我知道为什么会这样。您必须在后台线程中进行一些 UI 更改。
Do not change UI from anything but the main thread, it is bound to make your application unstable, and crash unpredictably.
使用 GCD(Grand Central Dispatch)。
您可以从任何线程收听和工作,并将 UI 更改封装在 dispatch_async:
dispatch_async(dispatch_get_main_queue(), ^{
// Do UI stuff here
});