2017-08-29 14:53:47.332368+0800 HuiDaiKe[2373:1135604] 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. Stack:( 0 CoreFoundation 0x0000000188e42ff8 <redacted> + 148 1 libobjc.A.dylib 0x00000001878a4538 objc_exception_throw + 56 2 CoreFoundation 0x0000000188e42f28 <redacted> + 0 3 Foundation 0x0000000189a35378 <redacted> + 128 4 Foundation 0x000000018987da38 <redacted> + 36 5 UIKit 0x000000018ef703b0 <redacted> + 816 6 UIKit 0x000000018ef7c2ac <redacted> + 1740 7 UIKit 0x000000018f2a57f0 <redacted> + 88 8 UIKit 0x000000018efd9b04 <redacted> + 376 9 UIKit 0x000000018f049840 <redacted> + 232 10 UIKit 0x000000018f0495b8 <redacted> + 244 11 UIKit 0x000000018f0543cc <redacted> + 932 12 UIKit 0x000000018f053eec <redacted> + 184 13 UIKit 0x000000018f053914 <redacted> + 1728 14 MJRefresh 0x00000001013c72bc -[UITableView(MJRefresh) mj_reloadData] + 40 15 HuiDaiKe 0x000000010013e440 _TFC8HuiDaiKe40CustomersAddressBookImportViewControllerP33_17FF30CE5B34E964041849EE3753856C13setDataSourcefGSaCS_19cwsAddressBookModel_T_ + 2728 16 HuiDaiKe 0x000000010013d968 _TFFC8HuiDaiKe40CustomersAddressBookImportViewControllerP33_17FF30CE5B34E964041849EE3753856C11prepareDataFT_T_U_FTOCS_14cwsAddressBook4typeGSaCS_19cwsAddressBookModel__T_ + 992 17 HuiDaiKe 0x00000001001c9cc0 _TFFC8HuiDaiKe14cwsAddressBook3getFT4backFTOS0_4typeGSaCS_19cwsAddressBookModel__T__T_U_FTS1_GSaS2___T_ + 252 18 HuiDaiKe 0x00000001001ca5c8 _TFFFC8HuiDaiKe14cwsAddressBookP33_FC9266F7BF731B8D62B76C7FA41D90D413check_iOS_9_0FT4backFTOS0_4typeGSaCS_19cwsAddressBookModel__T__T_U0_FTSbGSqPs5Error___T_U_FTSbGSaS2___T_ + 96 19 HuiDaiKe 0x00000001001caa04 _TFC8HuiDaiKe14cwsAddressBookP33_FC9266F7BF731B8D62B76C7FA41D90D411get_iOS_9_0fT4backFTSbGSaCS_19cwsAddressBookModel__T__T_ + 828 20 HuiDaiKe 0x00000001001ca544 _TFFC8HuiDaiKe14cwsAddressBookP33_FC9266F7BF731B8D62B76C7FA41D90D413check_iOS_9_0FT4backFTOS0_4typeGSaCS_19cwsAddressBookModel__T__T_U0_FTSbGSqPs5Error___T_ + 220 21 HuiDaiKe 0x00000001001ca6bc _TTRXFo_dSboGSqPs5Error____XFdCb_dSbdGSqCSo7NSError___ + 132 22 ContactsFoundation 0x0000000191862748 <redacted> + 288 23 ContactsFoundation 0x000000019186d680 <redacted> + 600 24 Contacts 0x00000001918c814c <redacted> + 72 25 libdispatch.dylib 0x0000000187cfa9e0 <redacted> + 24 26 libdispatch.dylib 0x0000000187cfa9a0 <redacted> + 16 27 libdispatch.dylib 0x0000000187d090d4 <redacted> + 644 28 libdispatch.dylib 0x0000000187d0aa50 <redacted> + 540 29 libdispatch.dylib 0x0000000187d0a7d0 <redacted> + 124 30 libsystem_pthread.dylib 0x0000000187f03100 _pthread_wqthread + 1096 31 libsystem_pthread.dylib 0x0000000187f02cac start_wqthread + 4 )
在子線程中更新UI致使主線程的視圖佈局出錯swift
把更新UI的操做放在主線程中執行app
DispatchQueue.main.async { self.mainTableview.reloadData() }