• 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
How to perform delayed calls using NSOperationQueue?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to perform delayed calls using NSOperationQueue?


  • Subject: How to perform delayed calls using NSOperationQueue?
  • From: Jens Alfke <email@hidden>
  • Date: Mon, 21 Jul 2014 17:42:01 -0700

I’m starting to port a pretty complex source base from using NSURLConnection to using NSURLSession. (Primarily because this is the only way to get around the only-four-sockets-per-host limitation.) I thought it was going to be straightforward, until I saw that NSURLSession only supports scheduling delegate calls on an NSOperationQueue, not an NSRunLoop. So that means I now also have to convert a number of runloop dependencies in the same code, which I don’t understand how to do.

Case in point: I have a couple of things that require the use of delayed performs to schedule timing. What’s the equivalent of -performSelector:withObject:afterDelay: (or of NSTimer) for code that’s running under the control of an NSOperationQueue? I know this call won’t work on a queue (because the thread it’s on probably won’t have a runloop), but I’ve looked at the API docs and headers and don’t see anything comparable. Dispatch queues have dispatch_after, and I’d much rather use GCD than NSOperationQueue anyway*, but NSURLSession is forcing my hand.

—Jens

*  (I know there’s now an underlyingQueue property on NSOperationQueue, but that’s only in iOS 8 and I can’t rely on that yet.)
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: How to perform delayed calls using NSOperationQueue?
      • From: Roland King <email@hidden>
    • Re: How to perform delayed calls using NSOperationQueue?
      • From: Cody Garvin <email@hidden>
  • Prev by Date: Re: CGContext... logging messages
  • Next by Date: Re: How to perform delayed calls using NSOperationQueue?
  • Previous by thread: Auto layout and split views
  • Next by thread: Re: How to perform delayed calls using NSOperationQueue?
  • Index(es):
    • Date
    • Thread