项目里用了一份图片浏览的库,然后在进行图片浏览的时候,项目会偶然性的崩溃
崩溃代码
if (progress >= 1.0) {
- [_progressView removeFromSuperview];
_progressView=nil;
}
崩溃信息
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.
说是使用后台线程去修改布局,会出现诡异的崩溃。
解决办法
让[_progressView removeFromSuperview]; 方法在主线程中执行
修改后代码如下
if (progress >= 1.0) {
dispatch_async(dispatch_get_main_queue(), ^{
[_progressView removeFromSuperview];
_progressView=nil;
});
}