• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Removing an NSURLConnection from the current runloop?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: App crashes in Rosetta in "mouseMoved:"
  • Next by Date: Re: What framework & language is good for an old C++ mule.
  • Previous by thread: App crashes in Rosetta in "mouseMoved:"
  • Next by thread: CoreData: Enumerating through very large data sets?
  • Index(es):
    • Date
    • Thread