NSHTTPCookieStorage allows you to update the cookies for every request made from your application. UIWebViews will respond to this changes in cookies at run time and NSHTTPCookieStorage allows you to listen for changes in cookies as the are normaly set in the browser.
To get the cookies for any url use:
NSHTTPCookieStorage* cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
NSArray* theCookies = [cookieStorage cookiesForURL:[NSURL URLWithString:@"http://example.com"]];
This makes it possible to easily login or logout a user from a website presented in your UIWebView.
Checkout NSHTTPCookieStorage* for all the details.
4 comments: