iOS错误&解决

Modifications to the layout engi

2021-03-24  本文已影响0人  燃_火

主线程刷新UI崩溃问题,Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.大概意思是:不能在后台线程中改变UI布局,必须在主线程中执行。
解决方法:添加同步执行

dispatch_sync(dispatch_get_main_queue(), ^{
    //刷新UI的代码放到主线程执行
});
上一篇 下一篇

猜你喜欢

热点阅读