title: iOS wait block until complete
body: <p>I have created a block void function wich is using AFNetworking library. This function is used for <code>GET</code> request and uses like so.</p>
  
  <pre><code>[Mics getRequestBLOCK:clientsUrlStr BlockRequest:^(NSString *response) {
      //use response here
  }];
  </code></pre>
  
  <p>Everything work fine, but I really get a headache when I use this block in a function that need return a value, for instance.</p>
  
  <pre><code>+ (NSArray*)OnlineClients
  {
      NSString *clientsUrlStr = [NSString stringWithFormat:@"%@/sinch/clients", ROOT_URL];
      __block NSArray *clients = [[NSArray alloc] init];
      [Mics getRequestBLOCK:clientsUrlStr BlockRequest:^(NSString *response) {
          clients = [response componentsSeparatedByString: @","];
      }];
  
      return clients;
  }
  </code></pre>
  
  <p><code>OnlineClients</code> array function always return 0 item because request block is not finished with completion.</p>
  
  <p><strong>So, how can I wait for block completion to get response request for return in a function?</strong></p>
  
  <p>I have been searching various topics in StackOverflow and google but can't found any solution.</p>
  
  <p>Please help.</p>