崩溃日志:
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.
原因:一个后台线程修改自动布局引擎,这可能导致引擎腐败和奇怪的崩溃,
我的程序中崩溃的原因是[tableView reloadData]刷新数据时导致crash
解决方法:把更新UI的放在主线程就好了,然后将[tableView reloadData]这个方法放在主线程中就可以了
//在主线程上执行didThread:,waitUntilDone表示是否在当前线程等待该方法执行完成
[self performSelectorOnMainThread:@selector(didThread) withObject:@"11" waitUntilDone:NO];
- (void)didThread{
if ([NSThread isMainThread]) {
//这里写主线程要写的代码
[tableView reloadData]
}
}