欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

iOS AFNetworking中cookie重定向代码

程序员文章站 2023-12-19 20:06:16
// 1. 取出需要同步的url (登录请求中返回的重定向地址) besthttpitem *httpitem = [besthttphelper sharedh...
// 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重定向代码,希望对大家有所帮助

上一篇:

下一篇: