William Niu
William Niu

Reputation: 15853

Do requests in UIWebView use sharedHTTPCookieStorage?

From googling a bit, the answer to my question is "yes". But how do I test that?

I tried to inpsect the HTTP request headers (i.e. [request allHTTPHeaderFields]) in webView:shouldStartLoadWithRequest:navigationType:, but none of the request has the "Cookie" entry, even though cookies are successfully stored in [NSHTTPCookieStorage sharedHTTPCookieStorage].

Upvotes: 2

Views: 1872

Answers (1)

Aaron Saunders
Aaron Saunders

Reputation: 33345

try this to loop through all the cookies in the UIWebView to verify they are there

NSHTTPCookie *aCookie;
for (aCookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {
   NSLog(@"%@", aCookie);
}

Upvotes: 4

Related Questions