I have a very strange problem, I am requesting a URL and I want to receive cookies from it, I used this method to receive cookies:
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { NSHTTPURLResponse *HTTPResponse = (NSHTTPURLResponse *)response; NSDictionary *fields = [HTTPResponse allHeaderFields]; NSString *cookie = [fields valueForKey:"Set-Cookie"]; }
BUT cookies are not filled out, there is no field, I checked it on PostMan, there are all cookies.
I also used this method when running NSURLRequest .
[request setHTTPShouldHandleCookies:YES]
Where is the problem?
NOTE. This problem applies to iOS, I have an Android version and it works fine, and all cookies are there.
objective-c cookies nsurlrequest
Scar
source share