In my application, I have a UIWebview
that loads linkedin auth page for login. When user logs in, cookies saves into the application.
My app has a logout button that is not related to linkedin login. So when user clicks on this button, he logs off from the app. I want that this log off will clear his linkedin cookies also from the app, so that user will log out completely.
According to this question, you can go through each cookie in the "Cookie Jar" and delete them, like so:
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *cookie in [storage cookies]) {
[storage deleteCookie:cookie];
}
[[NSUserDefaults standardUserDefaults] synchronize];