Hmm. In partial answer to my own question, the taskIdentifier cannot be used, because it seems to restart every session.
I guess I could put something in the taskDescription, but that's documented as being human-readable. > On Feb 9, 2015, at 17:37 , Rick Mann <[email protected]> wrote: > > 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 protected] > > > > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Macnetworkprog mailing list ([email protected]) > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/macnetworkprog/rmann%40latencyzero.com > > This email sent to [email protected] -- Rick Mann [email protected] _______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com This email sent to [email protected]
