Loading

IOS:Main Thread Checker: UI API called on a background thread: -[UIImageView setImage:] PID: 17771, TID:

在NSURLSession的接口回调中,使用了设置UI的操作

然后就报了这个错误,这个应该是因为NSURLSession开了子线程去调用,而Ui的操作需要在主线程中,获得主线程然后去操作即可

 dispatch_sync(dispatch_get_main_queue(),^{
                             //UI操作的代码
                        });

 

posted @ 2021-01-07 10:31  DDD-SagerKing  阅读(170)  评论(0编辑  收藏  举报