升级iOS9.1、xcode7.1后,
iOS也有类似android4.0之后在子线程中不能更新UI的规定了,
如果在后台线程中操作UI的话,
会提示如下错误:
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的代码放进dispatch_async中进行调用:
dispatch_async(dispatch_get_main_queue(), {
//更新ui
})