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 protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to