| 1 2 3 4 5 6 7 |
// 1. 取出需要同步的url (登录请求中返回的重定向地址)
BESTHttpItem *httpItem = [BESTHttpHelper sharedHelper].curHttpItem;
NSString *url = [NSString stringWithFormat:@"%@/#/login", httpItem.frontend_addr];
// 2. 取出当前的headerFields
NSDictionary *headerFields = [NSHTTPCookie requestHeaderFieldsWithCookies:self.cookies];
// 3. 替换cookie地址
[NSHTTPCookie cookiesWithResponseHeaderFields:headerFields forURL:[NSURL URLWithString:url]];
|
以上所述是小编给大家介绍的iOS AFNetworking中cookie重定向代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!








发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。