ios wkwebview didReceiveAuthenticationChallenge crash解决

//需要响应身份验证时调用 同样在block中需要传入用户身份凭证

//现在就是不进行https验证了 然后就闪退不了了

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

    

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

        

        NSURLCredential *card = [[NSURLCredential alloc]initWithTrust:challenge.protectionSpace.serverTrust];

        

        completionHandler(NSURLSessionAuthChallengeUseCredential,card);

    }

}

posted @ 2019-06-18 14:25  狼狼a够  阅读(3667)  评论(1编辑  收藏  举报