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 14:35:13 -0400
Yeah it would be nice to have block option for partial data delivery of a task along with a completion block, so you can stream (have old XML stream parsing code that would benefit from that, quicker value to the user while the larger data set is loaded).
In general most of the code I have run across creates only a few connections simultaneously and often recreates nearly similar ones over time. In those situations maintaining a handful of sessions and reusing them by firing of tasks is a short mapping away from what we had with connections.
Of course your experience outlines the other side of this with many connections in flight wouldn't be efficiently / wisely mapped to a session.
On Jul 22, 2014, at 1:54 PM, Jens Alfke < email@hidden> wrote: On Jul 22, 2014, at 10:24 AM, Shawn Erickson < email@hidden> wrote: I am not implying anything close to that number.
Well, you did say "sessions align more closely with connections of old”. And it’s not unusual to create large numbers of simultaneous NSURLConnections, like when downloading a bunch of resources in parallel the way a web browser does.
But you made a good point earlier about "leveraging the completion blocks per task instead of depending on delegate callbacks” — I hadn’t paid attention to those convenience methods. It looks like these would work well in the common case where you want to buffer up all the response data and then handle it at the end, probably doing away with the need to de-multiplex delegate calls. Unfortunately I’ve got a couple of tasks that need to stream the incoming data and parse it incrementally, which those won’t work for.
—Jens
|
_______________________________________________
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