Re: NSURLConnection unhappiness
Re: NSURLConnection unhappiness
- Subject: Re: NSURLConnection unhappiness
- From: Jeff Johnson <email@hidden>
- Date: Thu, 30 Apr 2009 00:44:34 -0500
Hi Nick.
You can't sleep the thread. According to the documentation for -
[NSThread sleepForTimeInterval:], "No run loop processing occurs while
the thread is blocked.". You need to run the run loop for the
connection to process.
On an unrelated note, your use of "self->connection", etc., is non-
standard and not advised. You should be using direct ivar access
"connection", properties "self.connection", or accessor methods "[self
connection]".
-Jeff
On Apr 29, 2009, at 11:31 PM, Nick Hristov wrote:
- (void) downloadData
{
NSLog([self->connection description]);
NSLog(@"run, b*$#4rd, run...");
[self->connection scheduleInRunLoop:[NSRunLoop currentRunLoop]
forMode:NSDefaultRunLoopMode];
[self->connection start];
int timeout = 30;
int i = 0;
while(self->finished == NO && [self _deletegateTerminateCheck] ==
NO) {
// suspend thread
[NSThread sleepForTimeInterval: 1.0];
i++;
/// stupid, but effective safety measure:
if(i >= timeout) {
break;
}
}
}
_______________________________________________
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