ios – 如何使用WKWebView正确实现身份验证质询?

前端之家收集整理的这篇文章主要介绍了ios – 如何使用WKWebView正确实现身份验证质询?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在构建一个Web浏览器,在网络方面我真的很新手.

我想测试下面的代码示例,但我没有现实生活中的例子:

- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition,NSURLCredential * _Nullable))completionHandler
{
    CFDataRef exceptions = SecTrustCopyExceptions(challenge.protectionSpace.serverTrust);

    SecTrustSetExceptions(challenge.protectionSpace.serverTrust,exceptions);

    CFRelease(exceptions);

    completionHandler(NSURLSessionAuthChallengeUseCredential,[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
}

任何人都可以提供我可以测试上面代码的URL吗?

编辑:我开始赏金,因为我感到筋疲力尽.我正在完成我创建的应用程序,每天都会出现很多问题.我真的很感激你的帮助!

解决方法

原文链接:https://www.f2er.com/iOS/333788.html

猜你在找的iOS相关文章