> On Dec 9, 2015, at 02:33 , Quinn The Eskimo! <eski...@apple.com> wrote:
> 
> 
> On 9 Dec 2015, at 09:49, Rick Mann <rm...@latencyzero.com> wrote:
> 
>> The docs say "If you call the invalidateAndCancel method, the session calls 
>> this delegate method immediately." So, it's no different.
> 
> IMO the docs are misleading here.  There's two things to keep in mind:
> 
> * If you start a task in a session, it will always run to completion, meaning 
> that you'll eventually get a -URLSession:task:didCompleteWithError: callback.

Is this also true when using completion blocks? I don't implement the delegate. 
My block doesn't seem to get called if I cancel tasks.

> 
> * -URLSession:didBecomeInvalidWithError: is always the last delegate callback 
> you receive for a given session.

Too bad -invalidateAndCancel doesn't take a completion block.

> 
> These two facts mean that, if you -invalidateAndCancel a session with 
> multiple outstanding tasks, the tasks will all complete (with 
> NSURLErrorDomain / NSURLErrorCancelled) and then you'll get the 
> didBecomeInvalidWithError callback.
> 
> If this wasn't clearly explained by the documentation, please do file a bug 
> about that.

The docs seem quite explicit that the delegate method will be called 
immediately. If you're telling me otherwise, as you seem to be, then I'd say 
you've identified a problem in the docs.

> 
> <https://developer.apple.com/bug-reporting/>
> 
> 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      (Macnetworkprog@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/macnetworkprog/rmann%40latencyzero.com
> 
> This email sent to rm...@latencyzero.com


-- 
Rick Mann
rm...@latencyzero.com



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (Macnetworkprog@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to