title: dispatch_group_notify does not wait for one dispatch_group_async
body: <p>Two concurrent background tasks need to patch two separate arrays which need to be merged in a dispatch_group_notify block.The problem is that.the first block is exceeded but the dispatch_group_notify is exceeded without waiting for the execution of the second background task.
  The only different between them is that the first one make a local search and the second one makes a remote call to a web service.Any clue why the second one is jumped over ?</p>
  
  <p>Edit: I also tried the approach mentioned in <a href="https://stackoverflow.com/a/19580584/859742">https://stackoverflow.com/a/19580584/859742</a> using dispatch_barrier_async but still same. </p>
  
  <pre><code> dispatch_group_t taskGroup = dispatch_group_create(); 
   dispatch_queue_t mainQueue = dispatch_get_main_queue();
  
  __block NSArray *localAddresses;
  __block NSArray *remoteAddresses;
  
  //Get local array in the background 
  dispatch_group_async(taskGroup, mainQueue, ^{
      //localAddresses  is set
  });
  
  //get remote array from server
  dispatch_group_async(taskGroup, mainQueue, ^{
   [[MDAddressManager instance] searchForPlacesContainingText:query
                                                        location:alocation
                                                      completion:^(NSArray* addresses, MDError *error){
         //remoteAddresses is set
  });
  
  
  //Merge two arrays
  dispatch_group_notify(taskGroup, mainQueue, ^{
     //remoteAddresses and local addresses are merged
  });
  </code></pre>
  
  <p>And the remote search method looks like this</p>
  
  <pre><code>- (void)searchForPlacesContainingText:(NSString *)searchText
                           location:(CLLocation *)alocation
                         completion:(MDAddressManagerBlock)completionBlock
  {
  NSDictionary *parameters = [[NSMutableDictionary alloc] init];
  
  [parameters setValue:searchText forKey:@"input"];
  
  [[MDHTTPClient sharedHTTPClient] getPath:@"v1/remotePlaces.json"
                                parameters:parameters
                                   success:^(AFHTTPRequestOperation *operation, id dict) {
  
      if ([MDHTTPClient isResponseValid:dict])
      {
              completionBlock(returnArray, nil);
      }
      else
      {
              completionBlock(nil, nil);
      }
  
  } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
      EDLog(@"%@", error);
      completionBlock(nil, [MDError errorAFNetworking:error]);
  }];
  }
  </code></pre>