I want to allow invalid SSL certificates with AFNetworking

Solution 1:

In AFNetworking 2.0, you can use the following:

[AFHTTPRequestOperationManager manager].securityPolicy.allowInvalidCertificates = YES;

Solution 2:

To allow Invalid SSL Certificate with AFNetworking. Add the following line in AFURLConnectionOperation.h below #import Availability.h

#define _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_ 1

Solution 3:

You can now use the allowsInvalidSSLCertificate property of the AFHTTPClient. No need to use defines in the latest versions of AFNetworking.

AFHTTPClient* client = [AFHTTPClient clientWithBaseURL:@"url"];
client.allowsInvalidSSLCertificate = YES; //this defaults to no