Re: Why does -[NSURLConnection start] crash?

On 31/03/2009, at 3:32 , Jeff Johnson wrote:
Here's the sample code:

It crashes when calling this:

_connection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:NO];
[_connection start];

Google for NSURLConnection startImmediately

Second link:

Apparently when not using the simpler initWithRequest:delegate:, or even startImmediately:YES, the connection does not get scheduled in the current run loop. And again apparently, this causes unhappiness to occur when you eventually get around to calling start.

Simple fix, just stuff it in the current run loop before calling start and everyone gets along just fine.

[c scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];


Run macros from your iPhone with Keyboard Maestro Control!
or take a break with Derzle for your iPhone

Keyboard Maestro <> Macros for your Mac
Aragom Space War <> Don't get killed!
Derzle <> Enjoy a relaxing puzzle.
<> <>



Cocoa-dev mailing list (Cocoa-dev@xxxxxxxxxxxxxxx)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)

Help/Unsubscribe/Update your Subscription:

This email sent to maillists@xxxxxxxxx