Removing an NSURLConnection from the current runloop?
Removing an NSURLConnection from the current runloop?
- Subject: Removing an NSURLConnection from the current runloop?
- From: Jonathan del Strother <email@hidden>
- Date: Mon, 13 Mar 2006 16:52:40 +0000
I'm having to create my own runloop to process a NSURLConnection.
Once the connection has finished, I release it. From here, the
runloop should notice that it no longer has any input sources and so
exit. That's not happening, so I end up with a runloop hanging
around for each of my previous connections.
I detach a thread with this method:
-(void)runRequestLoop:(NSURLRequest*)request
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
downloadConnection = [[NSURLConnection alloc]
initWithRequest:request delegate:self];
[[NSRunLoop currentRunLoop] run];
NSLog(@" -- Finished request -- ");
[pool release];
}
currentRunLoop doesn't finish immediately - it sits there working on
the download request.
Once the download is finished, it calls this :
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
[downloadConnection cancel];
[downloadConnection release];
downloadConnection = nil;
NSLog(@"Connection released");
}
AFAICT, the runloop should no longer have any input sources, so it
ought to exit...right?
However, I never get the "Finished Request" message in the console.
Any ideas why not?
Thanks,
Jon
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden