可能的一个原因是设置了NSHTTPCookieDiscard这个key
NSMutableDictionary<NSString *, id> *properties = [NSMutableDictionary dictionary];
properties[NSHTTPCookieName] = @"aaa";
properties[NSHTTPCookieValue] = @"bbb";
// properties[NSHTTPCookieDiscard] = @"FALSE"; 该选项不生效,设置后会影响NSHTTPCookieExpires
properties[NSHTTPCookiePath] = @"/ccc/ddd";
properties[NSHTTPCookieExpires] = [[NSDate new] dateByAddingTimeInterval:3*3600*24];
properties[NSHTTPCookieDomain] = @"xxx.yyy.zzz";
NSHTTPCookie *cookie = [[NSHTTPCookie alloc] initWithProperties:properties];
NSLog(@"%@",cookie); // cookide 的过期时间应该设置成功了
发表回复
要发表评论,您必须先登录。