title: How to detect when a NSURLConnection has finished
body: <p>I'm trying to use <code>NSURLRequest</code> and <code>NSURLConnection</code> to get a small bit of data (around 50 bytes) from a web API. I'm pretty sure the code below is right, but how do I actually get the received data and detect when its all downloaded?</p>
  
  <pre><code>NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
  NSURLConnection *con = [[NSURLConnection alloc] initWithRequest:req delegate:self];
  </code></pre>