iOS中清除web的cookie方法和快取
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies])
{
[storage deleteCookie:cookie];
}
//快取web清除
[[NSURLCache sharedURLCache] removeAllCachedResponses];
[self.webView loadRequest:[NSURLRequest
if (url) {//清除所有cookie
NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:url];
for (int i = 0; i < [cookies count]; i++) {
NSHTTPCookie *cookie = (NSHTTPCookie *)[cookies objectAtIndex:i];
[[NSHTTPCookieStorage sharedHTTPCookieStorage
}
}
//清除某一特定的cookie方法
NSArray * cookArray = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:url];
for (NSHTTPCookie*cookie in cookArray) {
if ([cookie.name isEqualToString:@"cookiename"]) {
[[NSHTTPCookieStorage sharedHTTPCookieStorage
}
}