i am hitting a url with the following code:
NSData *responseData = [NSURLConnection sendSynchronousRequest:theRequestHttp returningResponse:&theResponse error:&theError];
and i have theRequestHttp initialized here:
NSMutableURLRequest *theRequestHttp = [[NSMutableURLRequest alloc] initWithURL:url];
no where do i have the cookie being added to the urlrequest... in fact, i have the following set:
[theRequestHttp addValue:nil forHTTPHeaderField:@"Cookie"];
i also tried with
[theRequestHttp setValue:nil forHTTPHeaderField:@"Cookie"];
is there any way to NOT add the Cookie?
[request setHTTPShouldHandleCookies:NO];
I don't know if you can disable automatic addition of cookies but you can delete cookies anytime you want using the following code
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *cookie in storage.cookies) {
[storage deleteCookie:cookie];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With