天天看點

iOS - 解決This application is modifying the autolayout engine from a background thread

This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.
           

原因

在子線程中進行了對UI控件的操作。比如在子線程下添加了一個UIView,而UI控件的操作都必須在主線程下~

解決方案

回到主線程更新UI

[[NSOperationQueue mainQueue] addOperationWithBlock:^{
    // 進行UI控件的操作
}];