• 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
Re: Associating context with background NSURLSession tasks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Associating context with background NSURLSession tasks


  • Subject: Re: Associating context with background NSURLSession tasks
  • From: Rick Mann <email@hidden>
  • Date: Mon, 09 Feb 2015 20:12:43 -0800

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@hidden> 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@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


--
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


References: 
 >Associating context with background NSURLSession tasks (From: Rick Mann <email@hidden>)

  • Prev by Date: Associating context with background NSURLSession tasks
  • Next by Date: Re: NSURLSession and cellular access
  • Previous by thread: Associating context with background NSURLSession tasks
  • Next by thread: Re: Associating context with background NSURLSession tasks
  • Index(es):
    • Date
    • Thread