Associating context with background NSURLSession tasks
Associating context with background NSURLSession tasks
- Subject: Associating context with background NSURLSession tasks
- From: Rick Mann <email@hidden>
- Date: Mon, 09 Feb 2015 17:37:03 -0800
It seems that the NSURLSession API is missing a very important piece: a mechanism for associating context with a background task.
With my NSURLConnection-based code, I essentially created a generic delegate for each connection, which was responsible for invoking blocks for the various connection events. The blocks then captured the necessary context.
But with a background session, my app may be re-launched and have no in-memory context, so I need to resurrect that context from the NSURLSession and tasks API. I can't set the identifier of tasks (as far as I can tell), but I suppose I could use the provided task identifier, if it's guaranteed to be unique even after a task is complete.
Here's the thing. I'll have to persist that identifier along with enough information to reconstruct my context. If NSURLSession re-uses those identifiers, then I won't be able to reliably reconstruct the correct context.
Suggestions? Thanks,
--
Rick Mann
email@hidden
_______________________________________________
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