11

I have added the "ASIHTTPRequest" library to my app. Now, I'm trying to remove all warnings in my project. I have fixed all other warnings except those for "ASIHTTPRequest". I'm getting the warnings below.

'kCFStreamSSLAllowsExpiredCertificates' is deprecated:

'kCFStreamSSLAllowsAnyRoot' is deprecated:

How to resolve this?

Code:

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

screenshot

Pang
  • 9,564
  • 146
  • 81
  • 122
2vision2
  • 4,933
  • 16
  • 83
  • 164
  • Related: [Issue #395](https://github.com/pokeb/asi-http-request/issues/395) for `ASIHTTPRequest` on GitHub. – Pang Feb 02 '15 at 10:12

2 Answers2

29

As per the comments in CFSocketStream.h in the CFNetwork framework:

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

So the simple solution is to remove the deprecated keys and their values. Keep only kCFStreamSSLValidatesCertificateChain and kCFStreamSSLPeerName in the sslProperties dictionary.

Pang
  • 9,564
  • 146
  • 81
  • 122
Priya
  • 637
  • 4
  • 5
1

Add the following line above your declaration:

#pragma clang diagnostic ignored "-Wdeprecated-declarations"
machinehead115
  • 1,647
  • 10
  • 20