I copied the original text and made a record myself: https://blog.csdn.net/pianzhidenanren/article/details/52571853
//1. Create a queue group
dispatch_group_t group = dispatch_group_create();
//2. Create a queue
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
//3. Add request
dispatch_group_async(group, queue, ^{
dispatch_group_enter(group);
[HomeRequest getPointBuyAllConfigurationStrategyType:_dataType success:^(NSInteger code, NSDictionary *dict) {
dispatch_group_leave(group);
} failuer:^(NSInteger code, NSString *message) {
dispatch_group_leave(group);
}];
});
dispatch_group_async(group, queue, ^{
dispatch_group_enter(group);
[HomeRequest getStockLeverRiskStockCode:_buyingStrategyModel.stockCode strategyType:_dataType success:^(NSInteger code, NSDictionary *dict) {
dispatch_group_leave(group);
} failuer:^(NSInteger code, NSString *message) {
dispatch_group_leave(group);
}];
});
//4. All requests in the queue group complete the callback to refresh the UI
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
NSLog(@"model:%f",_buyingStrategyModel.leverrisk);
});