Re: Why does -[NSURLConnection start] crash?



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

http://lapcatsoftware.com/downloads/ConnectionStartCrash.m

It crashes when calling this:

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

Google for NSURLConnection startImmediately

Second link:

<http://veys.com/2008/08/17/nsurlconnection-startimmediatelyno-boom/>
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];


Enjoy,
Peter.

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

Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
Aragom Space War <http://www.stairways.com/iphone/aragom> Don't get killed!
Derzle <http://www.stairways.com/iphone/derzle> Enjoy a relaxing puzzle.
<http://www.stairways.com/> <http://download.stairways.com/>




____________________________________________...

___

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)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/maillists%40codeha.us

This email sent to maillists@xxxxxxxxx



Privacy