• 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
Re: NSURLConnection dependency on RunLoop (Sanity check)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSURLConnection dependency on RunLoop (Sanity check) (From: Andrei Tchijov <email@hidden>)
 >Re: NSURLConnection dependency on RunLoop (Sanity check) (From: j o a r <email@hidden>)
 >Re: NSURLConnection dependency on RunLoop (Sanity check) (From: Andrei Tchijov <email@hidden>)

  • Prev by Date: Re: Core Data Rookie
  • Next by Date: Re: Sorting Array Problems
  • Previous by thread: Re: NSURLConnection dependency on RunLoop (Sanity check)
  • Next by thread: Re: NSURLConnection dependency on RunLoop (Sanity check)
  • Index(es):
    • Date
    • Thread