Re: Why does -[NSURLConnection start] crash?
Re: Why does -[NSURLConnection start] crash?
- Subject: Re: Why does -[NSURLConnection start] crash?
- From: Peter N Lewis <email@hidden>
- Date: Tue, 31 Mar 2009 11:06:48 +0800
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 (email@hidden)
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:
This email sent to email@hidden