遇到程式掛掉,發出的錯誤訊息:
This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.
聽說可以用解法:
Swift 3
DispatchQueue.main.async {
// Update UI
}
Swift Version < 3
dispatch_async(dispatch_get_main_queue(){
// code here
})
Objective-C Version
dispatch_async(dispatch_get_main_queue(), ^{
// code here
});