dispatch_group_t group = dispatch_group_create();
// 发起网络请求1
dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
[HttpRequestUtil GET:Action_Home_Adv parameters:@{@"spaceId":@"1"} finished:^(AjaxResult *result) {
if (result.code == AjaxResultStateSuccess) {
NSArray* advArray = result.datas;
for (NSDictionary* diction in advArray) {
HXQADVModel* advModel = [HXQADVModel mj_objectWithKeyValues:diction];
[tempAdvList addObject:advModel];
}
}
dispatch_semaphore_signal(sema);
}];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
});
//发起网络请求2
dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
[HttpRequestUtil GET:Action_Channel_list parameters:@{@"page":@"0",@"count":@"4"} finished:^(AjaxResult *result) {
if (result.code == AjaxResultStateSuccess) {
[wSelf.channelList removeAllObjects];
[wSelf.channelList addObjectsFromArray:[HXQChannelModel mj_objectArrayWithKeyValuesArray:result.datas]];
}
dispatch_semaphore_signal(sema);
}];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
});
//发起网络请求3
dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
[HttpRequestUtil GET:Action_Project_RemdList parameters:nil finished:^(AjaxResult *result) {
if (result.code == AjaxResultStateSuccess) {
tempProjectList = [HXQProjectModel mj_objectArrayWithKeyValuesArray:result.datas];
}
dispatch_semaphore_signal(sema);
}];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
});
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
//所有网络请求都请求结束 这里处理多个请求回调数据并处理刷新显示
}); dispatch_group_t group = dispatch_group_cre