iphone - UIWebView中的请求是否使用sharedHTTPCookieStorage?

标签 iphone cookies uiwebview httpwebrequest

通过谷歌搜索,我的问题的答案是"is"。但我该如何测试呢?

我尝试检查 webView:shouldStartLoadWithRequest:navigationType: 中的 HTTP 请求 header (即 [request allHTTPHeaderFields]),但没有一个请求具有“Cookie”条目,即使 cookie 已成功存储在 [NSHTTPCookieStorage sharedHTTPCookieStorage] 中。

最佳答案

尝试循环遍历 UIWebView 中的所有 cookie 以验证它们是否存在

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

关于iphone - UIWebView中的请求是否使用sharedHTTPCookieStorage?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4362527/

相关文章:

android - 如何将用户身份验证放入移动应用程序

.net HttpCookie 类/ session cookie 问题

python - 根据位置抓取亚马逊价格时,cookie 随机无法保留位置信息?

javascript - jQuery cookies,设置上次访问的页面并重定向到新 session 中上次访问的页面

iphone - 加载某些网页时 UIWebview 崩溃

javascript - 如何拦截IOS上UIWebview中的Button点击?

iphone - iPhone用户历史数据库(SQLite?Core-Data?)

iphone - iPhone 中的消息/短信处理

objective-c - 如何在 UIWebView 中保存 .webarchive?

ios - 如何在 UIWebView 之上覆盖 UIButton(关闭)按钮?