How do I share a NSHTTPCookieStorage across multiple iOS apps? I want MYAPP A and MYAPP B to use the same cookies, so I can switch between them easily.
I found the following method in NSHTTPCookieStorage.h
but did not see it mentioned in the documentation.
+ (NSHTTPCookieStorage *)sharedCookieStorageForGroupContainerIdentifier:(NSString *)identifier NS_AVAILABLE(10_11, 9_0);
Answering my own question for the 6 other people who might run across this in the future...
In my research, I have found that
sharedCookieStorageForGroupContainerIdentifier:
is new functionality designed to work exclusively with NSURLSession, and allows you to directly specify cookie stores other thansharedHTTPCookieStorage
.Unfortunately, this functionality is not backwards compatible with the
NSURLConnection
suite of functionality, asNSURLConnection
automatically persists its cookies tosharedHTTPCookieStorage
, and this behavior cannot be overridden.TL;DR: If you want your own Cookie storage use NSURLSession.