开发者

How to enable cookies when POSTING with URLConnection in iPhone SDK?

开发者 https://www.devze.com 2022-12-08 08:50 出处:网络
I am trying to do a POST towards a site which utilizes secure session with cookies. Ofcourse this won\'t work with the code I have posted below. It keeps responding with a non-authorized message.

I am trying to do a POST towards a site which utilizes secure session with cookies. Ofcourse this won't work with the code I have posted below. It keeps responding with a non-authorized message.

Is there any way I can use cookies in my code or at least simulate cookie usage?

开发者_Python百科    NSURL *url = [[NSURL alloc] initWithString:@"https://long_and_complicated_url"];
 NSURLRequest *request = [[NSURLRequest alloc] initWithURL: url]; 
 NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];

Best regards //Abeansits


The SDK has cookie support in the form of NSHTTPCookie and NSHTTPCookieStorage

Have you familiarized yourself with these?

0

精彩评论

暂无评论...
验证码 换一张
取 消