I\'m trying to send an authentication string via cookie in a NSMutableURLRequest. I\'m trying to create the NSHTTPCookie through
+(id)cookieWithProperties:(
I noticed on, on my 2.2.1 iphone, that the cookie didn't get created if NSHTTPCookiePath is not specified, even though it is shown as "optional" in the docs:
So, I do:
NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys:
@"domain.com", NSHTTPCookieDomain,
@"/", NSHTTPCookiePath, // IMPORTANT!
@"testCookies", NSHTTPCookieName,
@"1", NSHTTPCookieValue,
nil];
NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:properties];
NSArray* cookies = [NSArray arrayWithObjects: cookie, nil];
NSDictionary * headers = [NSHTTPCookie requestHeaderFieldsWithCookies:cookies];
[request setAllHTTPHeaderFields:headers];