升級(jí)iOS9.1、xcode7.1后,
iOS也有類似android4.0之后在子線程中不能更新UI的規(guī)定了,
如果在后臺(tái)線程中操作UI的話励堡,
會(huì)提示如下錯(cuò)誤:
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.
這時(shí)必須將更新UI的代碼放進(jìn)dispatch_async中進(jìn)行調(diào)用:
dispatch_async(dispatch_get_main_queue(), {
//更新ui
})