<legend id='S7L3R'><style id='S7L3R'><dir id='S7L3R'><q id='S7L3R'></q></dir></style></legend>

    • <bdo id='S7L3R'></bdo><ul id='S7L3R'></ul>
  1. <small id='S7L3R'></small><noframes id='S7L3R'>

    <i id='S7L3R'><tr id='S7L3R'><dt id='S7L3R'><q id='S7L3R'><span id='S7L3R'><b id='S7L3R'><form id='S7L3R'><ins id='S7L3R'></ins><ul id='S7L3R'></ul><sub id='S7L3R'></sub></form><legend id='S7L3R'></legend><bdo id='S7L3R'><pre id='S7L3R'><center id='S7L3R'></center></pre></bdo></b><th id='S7L3R'></th></span></q></dt></tr></i><div id='S7L3R'><tfoot id='S7L3R'></tfoot><dl id='S7L3R'><fieldset id='S7L3R'></fieldset></dl></div>

    1. <tfoot id='S7L3R'></tfoot>

      UIWebView 中的 Cookie

      时间:2023-10-22
      <tfoot id='2m31B'></tfoot>

        • <legend id='2m31B'><style id='2m31B'><dir id='2m31B'><q id='2m31B'></q></dir></style></legend>

          • <bdo id='2m31B'></bdo><ul id='2m31B'></ul>
            <i id='2m31B'><tr id='2m31B'><dt id='2m31B'><q id='2m31B'><span id='2m31B'><b id='2m31B'><form id='2m31B'><ins id='2m31B'></ins><ul id='2m31B'></ul><sub id='2m31B'></sub></form><legend id='2m31B'></legend><bdo id='2m31B'><pre id='2m31B'><center id='2m31B'></center></pre></bdo></b><th id='2m31B'></th></span></q></dt></tr></i><div id='2m31B'><tfoot id='2m31B'></tfoot><dl id='2m31B'><fieldset id='2m31B'></fieldset></dl></div>

                <small id='2m31B'></small><noframes id='2m31B'>

                  <tbody id='2m31B'></tbody>
                本文介绍了UIWebView 中的 Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个 UIWebView,我不希望它存储 cookie,所以在加载 webview 之前我会这样做:

                I have a UIWebView, and I don't want it to store an cookies, so just before the webview is loaded I do:

                NSArray* cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
                for (NSHTTPCookie *cookie in cookies) {
                    [[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
                }
                

                检查 cookie 的计数为 0,因此它们都被删除.但是当我去 stackoverflow 时,它仍然可以识别我的 Google 帐户并让我登录.这是怎么发生的?我认为它与 cookie 一起使用?

                Checking the count of cookies is 0 so they are all deleted. But when I go to stackoverflow it still recognizes my Google Account and logs me in. How does this happen? I though it worked with cookies?

                推荐答案

                我不得不处理完全相同的问题,我找到了两种方法来处理这个问题.我首先注意到 cookie 会(有时)在奇怪的时间设置(奇怪的行为,尤其是 ios 4.0).

                I had to deal with the exact same issue and I found 2 ways to deal with that problem. I first noticed that cookies get (sometimes) set at weird times (Strange behaviour especially with ios 4.0).

                • 在用户浏览网页后立即删除 Cookie 通常无法获得预期的结果.

                然后我集成了一个持久的手动标志,该标志在注销"(也就是清除所有 cookie/删除其他用户数据)操作时设置为 True.在下一次登录(也就是基于用户登录的操作)时,我再次清除了 cookie(与您在代码发布中所做的相同).

                I then integrated a persistant, manual flag that was set True on a "logout" (aka clear all cookies / delete other user data) action. upon the next login (aka user-login-based action) I cleared the cookies again (the same way you did it in your code-post).

                后来我发现,听 NSHTTPCookieManagerCookiesChangedNotification 然后删除 cookie 也很有效.

                Later I found out, that listening to NSHTTPCookieManagerCookiesChangedNotification and then deleting cookies worked really well too.

                希望我能帮上忙.

                这篇关于UIWebView 中的 Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:使用 Xcode UI 测试测试 UIWebView 下一篇:iOS 8.0 UIWebView 文件输入使我的应用程序崩溃

                相关文章

                  <legend id='cPL5X'><style id='cPL5X'><dir id='cPL5X'><q id='cPL5X'></q></dir></style></legend>

                      <bdo id='cPL5X'></bdo><ul id='cPL5X'></ul>
                  1. <tfoot id='cPL5X'></tfoot>
                    <i id='cPL5X'><tr id='cPL5X'><dt id='cPL5X'><q id='cPL5X'><span id='cPL5X'><b id='cPL5X'><form id='cPL5X'><ins id='cPL5X'></ins><ul id='cPL5X'></ul><sub id='cPL5X'></sub></form><legend id='cPL5X'></legend><bdo id='cPL5X'><pre id='cPL5X'><center id='cPL5X'></center></pre></bdo></b><th id='cPL5X'></th></span></q></dt></tr></i><div id='cPL5X'><tfoot id='cPL5X'></tfoot><dl id='cPL5X'><fieldset id='cPL5X'></fieldset></dl></div>
                  2. <small id='cPL5X'></small><noframes id='cPL5X'>