1. <tfoot id='1cGI9'></tfoot><legend id='1cGI9'><style id='1cGI9'><dir id='1cGI9'><q id='1cGI9'></q></dir></style></legend>

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

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

        在 UIWebView 中启用 Cookie

        时间:2023-05-31

        <tfoot id='RPYHm'></tfoot>

          <tbody id='RPYHm'></tbody>
          <bdo id='RPYHm'></bdo><ul id='RPYHm'></ul>

            • <legend id='RPYHm'><style id='RPYHm'><dir id='RPYHm'><q id='RPYHm'></q></dir></style></legend>
              <i id='RPYHm'><tr id='RPYHm'><dt id='RPYHm'><q id='RPYHm'><span id='RPYHm'><b id='RPYHm'><form id='RPYHm'><ins id='RPYHm'></ins><ul id='RPYHm'></ul><sub id='RPYHm'></sub></form><legend id='RPYHm'></legend><bdo id='RPYHm'><pre id='RPYHm'><center id='RPYHm'></center></pre></bdo></b><th id='RPYHm'></th></span></q></dt></tr></i><div id='RPYHm'><tfoot id='RPYHm'></tfoot><dl id='RPYHm'><fieldset id='RPYHm'></fieldset></dl></div>
            • <small id='RPYHm'></small><noframes id='RPYHm'>

                  本文介绍了在 UIWebView 中启用 Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  如何在使用 UIWebView 窗口的 iPhone 应用程序中启用 cookie,以便我的登录系统正常工作?

                  How can I enable cookies in my iPhone Application that uses a UIWebView Window, so that my login system will work?

                  推荐答案

                  一定要开始

                  [NSHTTPCookieStorage sharedHTTPCookieStorage].cookieAcceptPolicy = 
                      NSHTTPCookieAcceptPolicyAlways;
                  

                  但是,正如@JoelFan 所提到的,问题可能是您的用户代理字符串导致 ASP.NET 尝试在无 cookie 登录时失败.而不是包含

                  But, as mentioned by @JoelFan, the issue may be your User Agent string causing ASP.NET to attempt and fail at a cookieless login. Instead of a response that includes

                  Set-Cookie:.ASPXAUTH=really-long-hex-number

                  Set-Cookie: .ASPXAUTH=really-long-hex-number

                  它返回一个重定向到类似的东西

                  it returns a redirection to something like

                  位置:/(F(long-sorta-base64ish-looking-string))/

                  默认的 UIWebView 用户代理字符串类似于

                  The default UIWebView user agent string is something like

                  用户代理:Mozilla/5.0(iPad;CPU OS 7_0_2,如 Mac OS X)AppleWebKit/537.51.1(KHTML,如 Gecko)Mobile/11A501

                  User-Agent: Mozilla/5.0 (iPad; CPU OS 7_0_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/11A501

                  但是 ASP.NET 不喜欢这样.Safari 会发送如下内容:

                  but ASP.NET doesn't like this. Safari sends something like this:

                  用户代理:Mozilla/5.0(iPad;CPU OS 7_0_2,如 Mac OS X)AppleWebKit/537.51.1(KHTML,如 Gecko)Version/7.0 Mobile/11A501 Safari/9537.53

                  User-Agent: Mozilla/5.0 (iPad; CPU OS 7_0_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A501 Safari/9537.53

                  尽早执行以下操作,可能在您的 AppDelegate.m 中

                  Do the following early on, maybe in your AppDelegate.m

                  // DON'T try to reuse a UIWebView for this. 
                  UIWebView *wv = [[UIWebView alloc] initWithFrame:CGRectZero];
                  // This webview has already decided to use the default user agent string.
                  
                  // let's use javascript to get the existing user agent string
                  NSString *userAgent = [wv stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];
                  
                  // let's tack on some stuff to make ASP.NET happy
                  userAgent = [userAgent stringByAppendingString:@" Version/7.0 Safari/9537.53"];
                  
                  [[NSUserDefaults standardUserDefaults] registerDefaults:@{@"UserAgent": userAgent}];
                  // New UIWebViews inited after here will use the user agent string you made.
                  

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

                  上一篇:URLForUbiquityContainerIdentifier: 应该在主线程之外的线 下一篇:iPhone GPS - 电池消耗极快

                  相关文章

                  最新文章

                    <bdo id='LZYZJ'></bdo><ul id='LZYZJ'></ul>

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

                    1. <legend id='LZYZJ'><style id='LZYZJ'><dir id='LZYZJ'><q id='LZYZJ'></q></dir></style></legend>
                    2. <small id='LZYZJ'></small><noframes id='LZYZJ'>