NSHTTPCookieStorage deleteCookie
- (void)deleteCookie:(NSHTTPCookie *)aCookie
Parameters of [NSHTTPCookieStorage deleteCookie]
aCookie
The cookie to delete.
NSHTTPCookieStorage deleteCookie example.
NSHTTPCookieStorage* cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage];
NSArray* facebookCookies = [cookies cookiesForURL:
[NSURL URLWithString:@"http://login.facebook.com"]];
for (NSHTTPCookie* cookie in facebookCookies) {
[cookies deleteCookie:cookie];
}
NSArray* facebookCookies = [cookies cookiesForURL:
[NSURL URLWithString:@"http://login.facebook.com"]];
for (NSHTTPCookie* cookie in facebookCookies) {
[cookies deleteCookie:cookie];
}
Example of [NSHTTPCookieStorage deleteCookie].
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *each in cookieStorage.cookies) {
[cookieStorage deleteCookie:each];
}
for (NSHTTPCookie *each in cookieStorage.cookies) {
[cookieStorage deleteCookie:each];
}
NSHTTPCookieStorage deleteCookie example.
NSArray *newCookie = [NSArray arrayWithArray:[[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]];
for (NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {
[[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
}
for (NSHTTPCookie *cookie in newCookie) {
NSMutableDictionary *properties = [NSMutableDictionary dictionaryWithDictionary:cookie.properties];
[properties removeObjectForKey:NSHTTPCookieExpires];
NSHTTPCookie *changeCookie = [NSHTTPCookie cookieWithProperties:properties];
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:changeCookie];
for (NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {
[[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
}
for (NSHTTPCookie *cookie in newCookie) {
NSMutableDictionary *properties = [NSMutableDictionary dictionaryWithDictionary:cookie.properties];
[properties removeObjectForKey:NSHTTPCookieExpires];
NSHTTPCookie *changeCookie = [NSHTTPCookie cookieWithProperties:properties];
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:changeCookie];