Do requests in UIWebView use sharedHTTPCookieStorage?
From googling a bit, the answer to my question is "yes". But how do I test that?
I trie开发者_运维问答d 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]
.
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);
}
精彩评论