主線程刷新UI崩潰問題,Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.大概意思是:不能在后臺線程中改變UI布局,必須在主線程中執(zhí)行。
解決方法:添加同步執(zhí)行
dispatch_sync(dispatch_get_main_queue(), ^{
//刷新UI的代碼放到主線程執(zhí)行
});