On 23 Feb 2016, at 15:57, Jens Alfke <j...@mooseyard.com> wrote:

> I thought this wasn’t possible anymore, since CFNetwork is implemented in C? 
> I.e, I thought CFNetwork just made C calls to that 
> `NSHTTPCookieStorageInternal` thing and bypassed the Obj-C API.

That situation is, well, fluid.  Historically this stuff was all in 
Objective-C, so subclassing worked just fine.  The introduction of the 
CFNetwork underpinnings made subclassing a risky proposition.  Recently more of 
the underpinnings are actually in Objective-C, or explicitly support 
subclassing properly, so this is getting better again.

> If it really is subclassable, it looks like a subclass has to reimplement the 
> entire API by overriding and not calling `super`, correct?

Right.  I have another bug on file requesting that this be made easier 
<rdar://problem/16353274>.  Since filing that, however, I've found that it is 
easier than I originally thought, at least in the specific case of providing an 
alternative cookie store for NSURLSession.  IIRC you just need to override the 
'task' methods:

-storeCookies:forTask:
-getCookiesForTask:completionHandler:

None of the other methods get called; I recommend you implement them as no-ops, 
just in case.

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/archive%40mail-archive.com

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

Reply via email to