「iOS入門」AFNetworkingのcookieリダイレクトを実装するコード

サンプルコード
BESTHttpItem *httpItem = [BESTHttpHelper sharedHelper].curHttpItem;
NSString *url = [NSString stringWithFormat:@”%@/#/login”, httpItem.frontend_addr];
// headerFieldsの取得
NSDictionary *headerFields = [NSHTTPCookie requestHeaderFieldsWithCookies:self.cookies];
// cookieアドレスを置換
[NSHTTPCookie cookiesWithResponseHeaderFields:headerFields forURL:[NSURL URLWithString:url]];

Comments are closed.