zoukankan      html  css  js  c++  java
  • WKWebView 支持https请求

    - (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler {

        if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {

            

            if ([challenge previousFailureCount] == 0) {

                

                NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];

                

                completionHandler(NSURLSessionAuthChallengeUseCredential, credential);

                

            } else {

                

                completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);

                

            }

            

        } else {

            

            completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);   

            

        }

    }

  • 相关阅读:
    using 关键字在 C++ 中的几种用法
    Chromium 修改图片资源
    SAM&广义SAM
    Burnside和Polya
    笔记:杜教筛
    笔记:莫比乌斯反演
    Miller-Rabin
    点分治
    虚树
    计算几何
  • 原文地址:https://www.cnblogs.com/nyqmayi/p/7472575.html
Copyright © 2011-2022 走看看