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

      <legend id='ArCf7'><style id='ArCf7'><dir id='ArCf7'><q id='ArCf7'></q></dir></style></legend><tfoot id='ArCf7'></tfoot>
    1. <small id='ArCf7'></small><noframes id='ArCf7'>

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

      目标 c 发送 cookie 到 uiwebview

      时间:2023-10-22

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

                <small id='kbwlw'></small><noframes id='kbwlw'>

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

                  <tbody id='kbwlw'></tbody>
              2. 本文介绍了目标 c 发送 cookie 到 uiwebview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我需要发送 cookie 以登录 UIWebView,但是当我加载网页时,cookie 尚未发送.

                I need to send cookies for login to a UIWebView, but when I load the web page the cookies haven't been sent.

                我的代码是:

                CorreoViewController.m

                - (void)viewDidLoad
                {
                    [super viewDidLoad];
                
                    self.title =AMLocalizedString(@"Correo", @"");
                    NSURL *url=[NSURL URLWithString:@"https://cuentas.uv.es/cgi-bin/p/user/Usuario"];
                    NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:url];
                
                    NSArray * cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
                    NSDictionary * headers = [NSHTTPCookie requestHeaderFieldsWithCookies: cookies];
                
                    [request setHTTPMethod:@"Post"];
                    [request setHTTPShouldHandleCookies:YES];
                    [request setAllHTTPHeaderFields:headers];
                
                    NSLog(@"Request: %@", [[request allHTTPHeaderFields] objectForKey:@"cookie"]);
                
                    [self.webView loadRequest:request];
                    // Do any additional setup after loading the view.
                }
                

                我的 cookie 存储中的 cookie 是:

                And the cookies I have in my cookie storage are:

                COOKIE 0:NSHTTPCookie 版本:0 名称:PAPIAuthNcook"值:nBNqHJSdjgo1aBw0uGh3AXzELIHCxA%2FDbnipSHWZbU5Eh1cJfUr18GEP9zxB%2Bl%2FZGPBAKQu6oF2l%0AzIMt7ywiSECLBuOHJnvS7y6rVim2HfE%3D%0A"expiresDate:(null) 创建时间:2014-01-16 15:05:41 +0000 (4.11578e+08)sessionOnly:TRUE domain:"cuentas.uv.es" path:"/" isSecure:FALSE

                COOKIE 0: NSHTTPCookie version:0 name:"PAPIAuthNcook" value:"nBNqHJSdjgo1aBw0uGh3AXzElIHCxA%2FDbnipSHWZbU5Eh1cJfUr18GEP9zxB%2Bl%2FZGPBAKQu6oF2l%0AzIMt7ywiSECLBuOHJnvS7y6rVim2HfE%3D%0A" expiresDate:(null) created:2014-01-16 15:05:41 +0000 (4.11578e+08) sessionOnly:TRUE domain:"cuentas.uv.es" path:"/" isSecure:FALSE

                COOKIE 1:NSHTTPCookie 版本:0 名称:PAPIslist"value:"17201128679244079|https://uvapp.uv.es/" expiresDate:(null)创建时间:2014-01-16 15:05:41 +0000 (4.11578e+08) sessionOnly:TRUEdomain:"cuentas.uv.es" path:"/" isSecure:FALSE

                COOKIE 1: NSHTTPCookie version:0 name:"PAPIslist" value:"17201128679244079|https://uvapp.uv.es/" expiresDate:(null) created:2014-01-16 15:05:41 +0000 (4.11578e+08) sessionOnly:TRUE domain:"cuentas.uv.es" path:"/" isSecure:FALSE

                COOKIE 2:NSHTTPCookie 版本:0 名称:PAPIAuthNcook"值:nBNqHJSdjgo1aBw0uGh3AXzELIHCxA%2FDbnipSHWZbU5Eh1cJfUr18GEP9zxB%2Bl%2FZGPBAKQu6oF2l%0AzIMt7ywiSECLBuOHJnvS7y6rVim2HfE%3D%0A"expiresDate:(null) 创建时间:2014-01-16 15:05:41 +0000 (4.11578e+08)sessionOnly:TRUE domain:"as.uv.es" path:"/" isSecure:FALSE

                COOKIE 2: NSHTTPCookie version:0 name:"PAPIAuthNcook" value:"nBNqHJSdjgo1aBw0uGh3AXzElIHCxA%2FDbnipSHWZbU5Eh1cJfUr18GEP9zxB%2Bl%2FZGPBAKQu6oF2l%0AzIMt7ywiSECLBuOHJnvS7y6rVim2HfE%3D%0A" expiresDate:(null) created:2014-01-16 15:05:41 +0000 (4.11578e+08) sessionOnly:TRUE domain:"as.uv.es" path:"/" isSecure:FALSE

                COOKIE 3:NSHTTPCookie 版本:0 名称:PAPIslist"value:"17201128679244079|https://uvapp.uv.es/" expiresDate:(null)创建时间:2014-01-16 15:05:41 +0000 (4.11578e+08) sessionOnly:TRUE域:as.uv.es" 路径:/" isSecure:FALSE

                COOKIE 3: NSHTTPCookie version:0 name:"PAPIslist" value:"17201128679244079|https://uvapp.uv.es/" expiresDate:(null) created:2014-01-16 15:05:41 +0000 (4.11578e+08) sessionOnly:TRUE domain:"as.uv.es" path:"/" isSecure:FALSE

                AppDelegate.m

                - (void)applicationDidBecomeActive:(UIApplication *)application
                {
                    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
                    [[NSHTTPCookieStorage sharedHTTPCookieStorage]setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
                }
                

                提前谢谢你.

                推荐答案

                评论此行:

                 NSArray * cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
                    NSDictionary * headers = [NSHTTPCookie requestHeaderFieldsWithCookies: cookies];
                [request setAllHTTPHeaderFields:headers];
                

                cookies 是自动发送的.我希望这会对您有所帮助.

                the cookies are sent automatically. I hope this will serve you.

                这篇关于目标 c 发送 cookie 到 uiwebview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:在 uiwebview 中播放本地视频 下一篇:如何在 UIWebView 中搜索?

                相关文章

                <small id='feZhv'></small><noframes id='feZhv'>

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

                    <tfoot id='feZhv'></tfoot>