Maison > Questions et réponses > le corps du texte
- (void)getCookies:(NSURL *)url
{
NSArray *cookjar = [[NSHTTPCookieStorage sharedHTTPCookieStorage]cookiesForURL:url];
for (NSHTTPCookie *cookie in cookjar ) {
DLog(@"cookie.version===%lu,cookie.name===%@,cookie.domain===%@,cookie.path===%@,cookie.isSessionOnly===%@",(unsigned long)cookie.version,cookie.name,cookie.domain,cookie.path,cookie.isSessionOnly?@"TRUE":@"FALSE");
}
}
- (void)deleteCookies
{
NSHTTPCookieStorage *cookieJar = [NSHTTPCookieStorage sharedHTTPCookieStorage];
NSArray *_tmpArray = [NSArray arrayWithArray:[cookieJar cookies]];
for (id obj in _tmpArray) {
[cookieJar deleteCookie:obj];
DLog(@"NSHTTPCookie===%@",cookieJar);
}
}