title: How to wait for the callBack methods (or) response in for loop (Xcode, Objective C, iOS)?
body: <p>In my code i have multiple locations,I have to check all the locations are correct or not (checking with google api) if location is correct I have to get the coordinates for that location.</p>
  
  <p>I am trying to write the code in for loop is there any way to wait for the response in the for loop. </p>
  
  <p>I am pasting my code below.</p>
  
  <p>thanks in Advance.</p>
  
  <pre><code>for (int locationsCount=0;locationsCount&lt;results.count;locationsCount++)
      {
          NSString *googlelocations = [[results objectAtIndex:locationsCount]objectForKey:@"description"];
  
          if ([locationAddress isEqualToString:googlelocations])
          {
              [[LocationManager share] fetchLatLngForPlacename:googlelocations placeId:[[results objectAtIndex:locationsCount] objectForKey:@"place_id"] completion:^(double lat, double lng, NSError *error)
              {
                  [SVProgressHUD dismiss];
  
                  if (error) {
  
                  }else {
  
                      CLLocation *locationCoordinates = [[CLLocation alloc]initWithLatitude:lat longitude:lng];
  
                      NSMutableArray *globalArray = [[LocationManager share]getManualInterLocationArray];
                      NSMutableDictionary *dict = [[globalArray objectAtIndex:selectedTextField.tag] mutableCopy];
  
                      [dict setObject:locationCoordinates forKey:@"location_coordinates"];
  
                      [dict setObject:googlelocations forKey:@"location_Address"];
  
                      [dict setObject:[NSNumber numberWithBool:true] forKey:@"manualEntry_Flag"];
  
                      [globalArray replaceObjectAtIndex:selectedTextField.tag withObject:dict];
  
                      [[LocationManager share]saveManualInterLocationArray:globalArray];
  
                  }
  
              }];
          }
      }
  </code></pre>