Re: NSURLSessionTasks don't have their own delegates?!
Re: NSURLSessionTasks don't have their own delegates?!
- Subject: Re: NSURLSessionTasks don't have their own delegates?!
- From: Shawn Erickson <email@hidden>
- Date: Tue, 22 Jul 2014 12:28:08 -0400
Sorry by thing I meant object centralizing and managing multiple tasks.
I guess my point was that you don't need to confine yourself to a single global one, you can create multiple to divide up session behaviors for disjoint things.
The main thing is leveraging the completion blocks per task instead of depending on delegate callbacks.
-Shawn
> On Jul 22, 2014, at 12:20 PM, "Quinn \"The Eskimo!\"" <email@hidden> wrote:
>
>
>> On 22 Jul 2014, at 17:09, Shawn Erickson <email@hidden> wrote:
>>
>> In my experience you just create multiple session objects per thing needing tasks executed.
>
> That's not the way the API was intended to be used. The idea is to use your session object to group your requests logically. For example, this makes it easy to set your user agent string in one place.
>
> There are situations where I've needed to explicitly demultiplex the NSURLSession delegate callbacks but in general I've found that I like having the delegate callbacks funnelled into one place. In my experience my app already has an object that it's using to track a particular request but only a small subset of the actual NSURLSession delegate callbacks need to make it to that object. For example, I typically want to centralise my handling of authentication challenges.
>
> 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
_______________________________________________
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