title: How do I wait for a web call to return data on iOS without blocking the main thread?
body: <p>When my iOS app starts, I need to get some critical settings from my server (example: <a href="http://www.example.com/critical_app_settings.php" rel="nofollow">http://www.example.com/critical_app_settings.php</a>). I need to get this data <em>before</em> I load up the user's data.</p>
  
  <p>What is the proper way to make this call, basically "pause" the app, and yet still not block the main thread and be in good compliance?</p>
  
  <p>Currently I am doing this example, which obviously isn't correct, because it completely blocks everything:</p>
  
  <pre><code>NSData *myRequestData = [NSData dataWithBytes:[myRequestString UTF8String] length:[myRequestString length]];
  NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString: myURLString]]; 
  [request setHTTPMethod: @"POST"];
  [request setHTTPBody:myRequestData];
  NSURLResponse *response;
  NSError *error;
  NSString *returnString = [[NSString alloc] init];
  
  returnString = [[NSString alloc] initWithData:[NSURLConnection sendSynchronousRequest:request 
                                                                                 returningResponse:&amp;response 
                                                                                                error:&amp;error] 
                                                     encoding: NSASCIIStringEncoding];
  </code></pre>