title: NSURLConnection - didReceiveData didn't get called - iOS & ARC
body: <p>I'm currently experimenting with the twitter streaming api and i'm trying to get a stream with <code>NSURLConnection</code>. As it doesn't work with twitter, i simplified everything and tried to get some source-code out of google's website, but this doesn't work neither.</p>
  
  <p>The connection starts and ends, but without calling the <code>didReceiveData</code> delegate. I'm sure i'm missing something. Hope you guy's can help me!</p>
  
  <p>In the header: <code>@interface ViewController : UIViewController &lt;NSURLConnectionDataDelegate, NSURLConnectionDelegate, NSURLConnectionDownloadDelegate, NSURLAuthenticationChallengeSender&gt;</code> </p>
  
  <p>And in the body:</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
  
      NSURLConnection *connection;
      NSMutableURLRequest *request;
      // Do any additional setup after loading the view, typically from a nib.
      request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://www.google.com"]];
      [request setHTTPMethod:@"GET"];
      connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
      [connection start];
  }
  
  - (void)connectionDidFinishDownloading:(NSURLConnection *)connection destinationURL:(NSURL *)destinationURL {
      NSLog(@"Stream finished.");
  }
  
  - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
      NSString *dataString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
      NSLog(@"%@", dataString);
  }
  
  - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{
      NSLog(@"Connection failed!");
  }
  </code></pre>