3
votes

I'm recieving cookie in Set-Cookie header of NSURLResponse, but [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies] returns empty list. NSHTTPCookie, which i received from response, is HTTPOnly, secure and has no expiresDate. What can be reason of this behaviour of NSHTTPCookieStorage?

UPDATE:

I've checked NSHTTPCookieStorage accept policy right before request was sent and after response was received. It was NSHTTPCookieAcceptPolicyAlways , however, cookie wasn't been stored. If i send another request, that returns another cookie, storage automatically saves it. That cookie has expiration date and not HTTPOnly, so, i think, the problem is somewhere in cookie's properties, but i can't find any confirmation in documentation

1

1 Answers

1
votes

I found out what's the problem. Cookie was not stored automatically, because cookie domain and request/response domain are different.