I am using the new Basecamp API for my iOS basecamp client app. I want the user to be able to logout and switch accounts. But I can't as the account credentials stored in the browser cache are used every time I request authorization. I figured out I would need to flush browser cache to do this. How do I clear the browser cache?
Asked
Active
Viewed 5,084 times
6
-
How are you doing authentication? – Analog File Sep 18 '12 at 10:27
1 Answers
10
[[NSURLCache sharedURLCache] removeAllCachedResponses];
After that, you can deleting any associated cookies with in the UIWebView:
for(NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {
if([[cookie domain] isEqualToString:someNSStringUrlDomain]) {
[[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
}
}

Romit M.
- 898
- 11
- 28
-
@shyambhat, Would it only work `UIWebView` within the app or it can work for Mobile Safari too ? – Hemang Dec 29 '14 at 12:57
-
-
1Not works in my case. I am working on one application in which i have to fetch all emails of outlook user. After login successfully i get all emails listing. But when i try to login by different user that time it display first user data. Due to that unable to login by different user. – Protocol May 07 '19 at 11:53