Get cookies from NSHTTPURLResponse

前端 未结 5 912
忘掉有多难
忘掉有多难 2020-12-16 20:02

I\'ve an extremely weird problem, I\'m requesting a URL and I want to get the cookies from it, I\'ve used this way to get the cookies:

- (void)connection:(NS         


        
5条回答
  •  执笔经年
    2020-12-16 20:36

    Try this code:

    for (NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies])
    {
        NSLog(@"name: '%@'\n",   [cookie name]);
        NSLog(@"value: '%@'\n",  [cookie value]);
        NSLog(@"domain: '%@'\n", [cookie domain]);
        NSLog(@"path: '%@'\n",   [cookie path]);
    }
    

提交回复
热议问题