NSHTTPCookieStorage does not store cookies automatically

I get a cookie in Set-Cookie

the NSURLResponse header, but it [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]

returns an empty list. NSHTTPCookie

which I got from the answer, HTTPOnly

is safe and has no expiresDate

. What could be the reason for this behavior NSHTTPCookieStorage

?

UPDATE:

I checked NSHTTPCookieStorage

the acceptance policy before submitting the request and after receiving the response. It did NSHTTPCookieAcceptPolicyAlways

, however, the cookie was not saved. If I send another request that returns a different cookie, the store automatically saves it. This cookie has an expiration date, not HTTPOnly

, so I think the problem is somewhere in the cookie properties, but I can't find confirmation in the documentation

+3


source to share


1 answer


I figured out what the problem is. The cookie was not automatically saved because the cookie domain and request / response domain are different.



+1


source







All Articles