iOS 线程

2017-11-28  本文已影响59人  夏天爱西瓜汁

2016.9.9

//主线程队列

dispatch_queue_tmainQueue;

//子线程队列

dispatch_queue_tqueue;

//异步获取不然通讯录过多的时候可能阻塞线程几秒钟体验不好

dispatch_async(queue, ^{

[_viewModelseeContactsUsingApp:tmpPeoplessuccess:^(BOOLresult) {

self.contactArrays= [[NSMutableArrayalloc]init];

self.contactArrays=_viewModel.nameAndPhoneArray;

self.serverArray=_viewModel.contactArrays;

_rowArr= [ContactDataHelpergetFriendListDataBy:self.contactArrays];

_sectionArr= [ContactDataHelpergetFriendListSectionBy:[_rowArrmutableCopy]];

dispatch_async(mainQueue, ^{

[selfhideWaiting];

[_tableViewreloadData];

});

}failure:^(NSString*error) {

dispatch_async(mainQueue, ^{

[selfhideWaiting];

});

}];

});

上一篇 下一篇

猜你喜欢

热点阅读