设置cookie#####
NSMutableDictionary *cookieProperties = [NSMutableDictionary dictionary];
//从后台得到一些需要设置的cookie信息
NSArray *cookies = [[User Instance] getCookies];
for (NSDictionary *_cookieDic in cookies) {
[cookieProperties setObject:[_cookieDic objectForKey:@"name"] forKey:NSHTTPCookieName];
[cookieProperties setObject:[_cookieDic objectForKey:@"value"] forKey:NSHTTPCookieValue];
[cookieProperties setObject:[_cookieDic objectForKey:@"domain"] forKey:NSHTTPCookieDomain];
[cookieProperties setObject:[_cookieDic objectForKey:@"domain"] forKey:NSHTTPCookieOriginURL];
[cookieProperties setObject:[_cookieDic objectForKey:@"path"] forKey:NSHTTPCookiePath];
[cookieProperties setObject:[_cookieDic objectForKey:@"version"] forKey:NSHTTPCookieVersion];
[cookieProperties setObject:[_cookieDic objectForKey:@"comment"] forKey:NSHTTPCookieComment];
}
NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:cookieProperties];
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];
删除cookie#####
NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
for (NSHTTPCookie *cookie in cookies){
[[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
}