AFNetworking accesses the network. when a page needs to access the network for more than 2 times, how to wait for all network requests to be executed before performing other operations?

  ios, question

AFNetworking accesses the network. when a page needs to access the network for more than 2 times, how to wait for all network requests to be executed before performing other operations?

The simplest thing is to nest in the accessed callback window!

AFHTTPRequestOperationManager *managerFirst = [AFHTTPRequestOperationManager manager];
 [managerFirst GET:@"http://firsturl.com/resources.json" parameters:nil           success:^(AFHTTPRequestOperation *operation, id responseObject) {
 //Callback for Successful url Access in Tier 1
 //Launch the second visit immediately
 AFHTTPRequestOperationManager *managerSecond = [AFHTTPRequestOperationManager manager];
 [managerSecond GET:@"http://secondurl.com/resources.json" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
 NSLog(@"JSON: Percent @), responseobject);
 //second visit URL callback succeeded
 
 
 } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
 NSLog(@"Error: percentage @", error);
 //The second visit to url failed callback
 }];
 
 
 NSLog(@"JSON: Percent @), responseobject);
 } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
 //url access failed callback for the first time
 NSLog(@"Error: percentage @", error);
 }];