I'm trying to get a cookie from the server so with username and password and cookie I can login to the server.
In ASIHTTPRequest
I get the cookie as
JSESSIONID=Pt1vcPv0TbaRsK2J6nnWuHu4.pard; Path=/parity,JSESSIONID=z9Gf40eSCVsF3xYcG-yrONsU.pardemo; Path=/parity,NSC_QBSJUFN-EFNP=ffffffff090b1dd445525d5f4f58455e445a4a4229a0;path=/
While in NSHTTPCookie I get it very different this is how I call the cookie. Is there a way so I can get it as the result above?
NSMutableURLRequest *postRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.exapmle.com/server/api.ashx"]];
NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
NSHTTPCookie *cookie =[[NSHTTPCookie alloc]init];
for (int i = 0; i < [cookies count]; i++) {
cookie = [cookies objectAtIndex:i];
NSLog(@"Cookie: %@, %@, %@ ,%@", [cookie domain],[cookie path],[cookie name],[cookie value]);
}
}
ASIHttpRequest
has know issues with iOS 7 and 8, also the developers stopped maintaining it for some time now. I suggest you move toAFNetworking
it rater simple to replace anyASIHttpRequest
. – rckoenesAFNetworkin
. Can you please check this question. stackoverflow.com/questions/27101762/… – CAN