gpt4 book ai didi

ios - 'kCFStreamSSLAllowsExpiredCertificates' 和 'kCFStreamSSLAllowsAnyRoot' 已弃用

转载 作者:技术小花猫 更新时间:2023-10-29 10:42:43 25 4
gpt4 key购买 nike

我已将“ASIHTTPRequest”库添加到我的应用程序中。现在,我正在尝试删除项目中的所有警告。我已经修复了除“ASIHTTPRequest”之外的所有其他警告。我收到以下警告。

'kCFStreamSSLAllowsExpiredCertificates' is deprecated:

'kCFStreamSSLAllowsAnyRoot' is deprecated:

如何解决?

代码:

NSDictionary *sslProperties = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithBool:YES], kCFStreamSSLAllowsExpiredCertificates,
[NSNumber numberWithBool:YES], kCFStreamSSLAllowsAnyRoot,
[NSNumber numberWithBool:NO], kCFStreamSSLValidatesCertificateChain,
kCFNull,kCFStreamSSLPeerName,
nil];

screenshot

最佳答案

根据 CFNetwork 框架中 CFSocketStream.h 中的注释:

kCFStreamSSLAllowsExpiredCertificates:
kCFStreamSSLAllowsExpiredRoots:
kCFStreamSSLAllowsAnyRoot:

The SSL handshake flags which affect untrusted certificate chain evaluation are deprecated. Instead, use the single property kCFStreamSSLValidatesCertificateChain to disable certificate chain checking if the user has decided that it is appropriate to do so

因此,简单的解决方案是删除已弃用的键及其值。仅在 sslProperties 字典中保留 kCFStreamSSLValidatesCertificateChainkCFStreamSSLPeerName

关于ios - 'kCFStreamSSLAllowsExpiredCertificates' 和 'kCFStreamSSLAllowsAnyRoot' 已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26864785/

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