我已经在我的应用程序中添加了“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];
解决方法
根据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字典中只保留kcfStreamSSLValidatesCertificateChain和kcfStreamSSLPeerName.