Re: Multiple independent cookie stores?
Re: Multiple independent cookie stores?
- Subject: Re: Multiple independent cookie stores?
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Fri, 09 Jan 2015 08:41:26 +0000
On 8 Jan 2015, at 19:46, Jens Alfke <email@hidden> wrote:
> NSURLSessionConfiguration does allows some control over cookie storage, but it looks like the only option besides shared is to use non-persistent storage [...]
You're correct that there's currently no way to use the standard NSHTTPCookieStorage as a separate persistent cookie store. I filed a bug about that recently <rdar://problem/16353276>. My understanding, however, is that it should be relatively easy for you to create a subclass of NSHTTPCookieStorage to do that storage. Creating a fully-functional NSHTTPCookieStorage subclass is tricky <rdar://problem/16353274> but I've heard tell [1] that getting your subclass up and running enough to satisfy NSURLSession is pretty easy: you just have to implement the following two methods.
- (void)storeCookies:(NSArray *)cookies forTask:(NSURLSessionTask *)task;
- (void)getCookiesForTask:(NSURLSessionTask *)task completionHandler:(void (^) (NSArray *cookies))completionHandler;
Keep in mind that a lot of the heavy lifting is done by NSHTTPCookie itself.
I haven't had a chance to try this for myself, alas.
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
[1] <https://devforums.apple.com/message/1082683#1082683>
_______________________________________________
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