Can someone please show me how to save cookies FOREVER using AFNetworking for iOS? I'm using ios7 but I think this should not matter?
The use case is that upon successful authentication with a webservice, it gives me two cookies that I need to pass along with every single request. These cookies never expire, or expire years from now. As long as I have the cookies with each HTTPS request, the user doesn't have to login again. I understand that AFNetworking automatically persists cookies until you quit the app, but I need the cookies to last forever until the user deletes the app from their phone.
1) Upon successful authentication, the webservice hands me two cookies. How do I access them? Do I go straight to NSHTTPCookie storage and grab the cookie by its name, or is there an AFNetworking "way" to do this?
2) How do I save these two magic cookies permanently so that my subclass of AFHTTPClient passes these two magic cookies along with each request? Do I just save them inside a keychain or NSUserDefaults or NSURLCredentialsStorage? Or again is there an AFNetworking way to do this? I read about a setAuthorization() method inside AFNetworking but I'm not sure if this applies to username/password and cookies as well.
3) How do I delete these cookies the AFNetworking way?
Thanks!!