applicationShouldTerminate and asynch handling
applicationShouldTerminate and asynch handling
- Subject: applicationShouldTerminate and asynch handling
- From: Nicolas Berloquin <email@hidden>
- Date: Wed, 8 Dec 2004 02:06:21 +0100
Hello !
I have an document app that requires a series of HTTP
NSURLConnections when it quits. (The app uses
the very same HTTP requests while it normally runs, also).
Those HTTP requests can take a few seconds to accomplish.
When the user selects Quit, I would like to show a sheet to inform him
of the # of waiting connexions,
until they are all done. (there's also a "quit now" button).
OK, now I tried to implement this in a few different ways, but when I
launch those connexions from applicationShouldTerminate,
the connexions are launched (I NSLog() it, and I can see them do their
full course in netstat) but the NSURLConnections
never receive either the 'connectionDidFinishLoading' or
'didFailWithError' messages. Remember that the same
code works 100% well in other cases.
Here's more specifically what I'm doing:
- my NSDocumentControler is a delegate for applicationShouldTerminate.
Inside this, I launch the connexions,
open a sheet, and return NSTerminateLater.
I tried launching the connexions in many different ways:
- starting a separate thread that itself launches the connexions, then
waits for the result to close the sheet then quit.
- launching the connexions from applicationShouldTerminate, then having
the separate thread handle the flags etc.
- from applicationShouldTerminate, I used performSelectorOnMainThread:
(launchConnexions) waitUntilDone:NO
And whatever I try, the code that should receive the
connectionDidFinishLoading or didFailWithError doesn't seem to be
called.
Am I missing something ? thanks for any tip...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden