NSString *urlStr = @"https://";
// NSURL *Url = [NSURL URLWithString:@"https://"];
NSArray *cookiesArray = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:urlStr]];
NSString *jsession ;
for (NSHTTPCookie *cookie in cookiesArray) {
if ([cookie.name isEqualToString:@"JSESSIONID"]) {
jsession = nil;
jsession = cookie.value;
break;
}
}
循环后得到的便是JSESSIONID