Search code examples
iosiphoneswifthttpalamofire

Alamofire custom cookie store for multiple Managers


Trying to wrap my head around how to handle multiple Manager's in Alamofire. I need each Manager to contain it's own cookie storage. i,e: 10 Manager's running at once should have their own set of cookies. Im also using proxies for some and or all requests. Therefor im using NSURLSessionConfiguration, but only have the option of using defaultConfiguration which defeats the purpose, if all managers are internally using the default? Hope I explained this correctly. Any help would be appreciated. Thanks


Solution

  • Solved by utilizing URLSessionConfiguration's httpCookieStorage setting cookie storage with HTTPCookieStorage.sharedCookieStorage(forGroupContainerIdentifier:). Giving each one of my configs a different identifier.