NSMutableDictionary *scookieProperties = [NSMutableDictionary dictionary];
[scookieProperties setObject:@"_s" forKey:NSHTTPCookieName];
[scookieProperties setObject:@"true" forKey:@"HttpOnly"];
[scookieProperties setObjectSafe:cookieOne forKey:NSHTTPCookieValue];
[scookieProperties setObject:@".baidu.com"forKey:NSHTTPCookieDomain];
[scookieProperties setObject:@"/" forKey:NSHTTPCookiePath];
[scookieProperties setObject:@"0" forKey:NSHTTPCookieVersion];
NSHTTPCookie*scookie = [NSHTTPCookie cookieWithProperties:scookieProperties];
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:scookie];
NSMutableDictionary *tCookieProperties = [NSMutableDictionary dictionary];
[tCookieProperties setObjectSafe:@"cookieTwoName" forKey:NSHTTPCookieName];
[tCookieProperties setObjectSafe:cookieTwo forKey:NSHTTPCookieValue];
[tfCookieProperties setObjectSafe:@".baidu.com"forKey:NSHTTPCookieDomain];
[tCookieProperties setObjectSafe:@"/" forKey:NSHTTPCookiePath];
[tCookieProperties setObjectSafe:@"0" forKey:NSHTTPCookieVersion];
NSHTTPCookie *csrfHttpCookie = [NSHTTPCookie cookieWithProperties:tCookieProperties];
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:csrfHttpCookie];
iOS 设置Cookie HttpOnly
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 近期做了一个需要与Webview交互的项目,需要实现网页上的自动登录功能,参考了一些OC的代码,改为Swift 首...
- 获取本地的cookie,[SystemConfigure shareSystemConfigure].get_kH...
- 在使用UIWebView访问网站时,经常遇到的一个问题是需要登录。比如访问新浪微博,或者访问某个个人账号,但是需要...