Re: NSURLConnection dependency on RunLoop (Sanity check)
Re: NSURLConnection dependency on RunLoop (Sanity check)
- Subject: Re: NSURLConnection dependency on RunLoop (Sanity check)
- From: Randy Saldinger <email@hidden>
- Date: Thu, 21 Jul 2005 17:18:28 -0700
I did run into this problem while writing Unit Test case for my
code (so it is "command line" based situation).
I had a similar issue with NSURLConnection and a unit test driver. I
solved it by repeatedly restarting the current RunLoop until all the
connections were done. For example:
do
{
NSDate* cycle = [NSDate dateWithTimeIntervalSinceNow:0.5];
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:cycle];
}
while ( ! m_stopRunLoop );
where the m_stopRunLoop flag gets set to YES when I've counted that
all the NSURLConnection requests finished.
The half-second timeout is to ensure that, if something goes wrong,
it doesn't go off forever ... but I'm not really certain that it's
necessary. It may be sufficient to just call -run.
Randy
_______________________________________________
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