When i
Logger *logger = [Logger new];
NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
__unused NSURLConnection *conn = [[NSURLConnection alloc]
initWithRequest:request delegate:logger startImmediately:YES];
… nothing happens. Delegate methods are not called until i
[[NSRunLoop currentRunLoop]run];
I would have thought that startImmediately:YES would do exactly that.
async callbacks require an NSRunLoop. See:
Cocoa: NSURLConnection not attempting an HTTP Request
command line apps don’t have an NSRunLoop by default – gui apps do.
From the docs: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/Reference/Reference.html
initWithRequest:delegate:
Returns an initialized URL connection and begins to load the data for the URL request.