Xcode7: This application is modifying the autolayo

2019-06-16 19:58发布

I got this messages,when I updated Xcode7. Can you tell me solution? Thank.

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

标签: ios9 xcode7
1条回答
劫难
2楼-- · 2019-06-16 20:14

I don't know what your code is, but I have an idea as to why this is happening. You must be having some UI changes done in a background thread.

Do not change UI from anything but the main thread, it is bound to make your application unstable, and crash unpredictably.

Use GCD (Grand Central Dispatch).

You can listen and do work from any thread, and encapsulate UI changes in a dispatch_async:

dispatch_async(dispatch_get_main_queue(), ^{
        // Do UI stuff here
});
查看更多
登录 后发表回答