您的位置:首页 > 其它

问题:后台线程修改自动布局引擎

2016-07-18 18:46 351 查看
错误代码:

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.

原因:一个后台线程修改自动布局引擎,这可能导致引擎腐败和奇怪的崩溃

解决方法:把需要更新UI的放在的主线程就好了

//在主线程上执行didThread:,waitUntilDone表示是否在当前线程等待该方法执行完成
[self performSelectorOnMainThread:@selector(didThread) withObject:@"11" waitUntilDone:NO];


- (void)didThread{
if ([NSThread isMainThread]) {
NSLog(@"2.主线程");
//这里写主线程要写的代码
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: