May be this is a dumb question, but I want to store cookies for same url but different for usernames. How can this be achieved using NSHTTPCookieStorage ? This is how I store cookies from response.
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
NSDictionary *headerFields = [httpResponse allHeaderFields];
NSArray* cookies = [NSHTTPCookie
cookiesWithResponseHeaderFields:headerFields
forURL:[NSURL URLWithString:@""]];
for (NSHTTPCookie *cookie in cookies) {
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];
}
NSString *urlString = ...;
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookies:cookies forURL:[NSURL URLWithString:urlString] mainDocumentURL:nil];