gpt4 book ai didi

ios - UIWebView+AF联网问题

转载 作者:太空宇宙 更新时间:2023-11-03 13:51:53 24 4
gpt4 key购买 nike

我使用这段代码:

webView.loadRequest(request!, progress: nil, success: { (responce, html) in
print("\n\n\nsuccess responce = ", html)
return html
}, failure: { (error) in
print("\n\n\nerror = ", error)
})

但是我的服务器有无效的 SSL 证书。所以我需要设置一个安全策略。在我这样做之前:

[AFHTTPRequestOperationManager manager].securityPolicy.allowInvalidCertificates = YES;

但在 AFNetworking 3 中,不再有 AFHTTPRequestOperationManager 类。如何为 AFNetworking 3 中的所有请求设置安全策略?

最佳答案

AFNetworking 3 等同于 AFHTTPRequestOperationManagerAFHTTPSessionManager

所以你应该在 webView 本身上使用它:

webView.sessionManager.securityPolicy.allowInvalidCertificates = YES;

当然还有一种解决方法是修复服务器上的无效证书。

关于ios - UIWebView+AF联网问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40626196/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com