Re: Canceling and then retrying a bunch of tasks
Re: Canceling and then retrying a bunch of tasks
- Subject: Re: Canceling and then retrying a bunch of tasks
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Tue, 08 Dec 2015 09:11:59 +0000
On 8 Dec 2015, at 01:58, Rick Mann <email@hidden> wrote:
> Also, I presume this only works if the queue is a serial queue, but the docs say it doesn't have to be such.
You really want your NSURLSession delegate queue to be a serial queue. It's going to be very hard to maintain coherent state otherwise. Moreover, your delegate queue work should be fast, so serialisation isn't a problem. If you need to do real work in this context, that work itself should be farmed off to a separate thread/queue/NSOperation.
On 8 Dec 2015, at 03:52, Rick Mann <email@hidden> wrote:
> And, the answer is no. My completion block gets called MANY more times after I invalidate and cancel the session.
I'm confused by this. Are you looking to invalidate the session or not? If you don't mind invalidating the session (-invalidateAndCancel), you should be able to kick off the new work your -URLSession:didBecomeInvalidWithError: delegate callback, which is the last callback you'll get for this session and which will arrive after all your task cancellation callbacks have run.
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
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