1
2
3
4
5
6
7
|
// 1. 取出需要同步的url (登錄請求中返回的重定向地址) BESTHttpItem *httpItem = [BESTHttpHelper sharedHelper].curHttpItem; NSString *url = [NSString stringWithFormat:@ "%@/#/login" , httpItem.frontend_addr]; // 2. 取出當(dāng)前的headerFields NSDictionary *headerFields = [NSHTTPCookie requestHeaderFieldsWithCookies:self.cookies]; // 3. 替換cookie地址 [NSHTTPCookie cookiesWithResponseHeaderFields:headerFields forURL:[NSURL URLWithString:url]]; |
以上所述是小編給大家介紹的iOS AFNetworking中cookie重定向代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對服務(wù)器之家網(wǎng)站的支持!