block回调刷新UI填坑

在block回调中要去刷新界面,遇到这样的问题

 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


block回调刷新UI填坑_第1张图片
错误信息

错误代码如下

_coutTimeV.timeOut = ^(){
   [weakSelf.coutTimeV endCountDown];
   [weakSelf doSomething];
};

修改后

_coutTimeV.timeOut = ^(){
   [weakSelf.coutTimeV endCountDown];
   //通知主线程去做刷新动作
   dispatch_async(dispatch_get_main_queue(), ^{
     [weakSelf doSomething];
   });
};

小白总结,欢迎打脸指正

你可能感兴趣的:(block回调刷新UI填坑)