I had been using AFNetworking 2.5.4 with Swift 1.2 successfully communicating with our server using a self signed, untrusted certificate. Security policy was set as documented on AFNetworking site as:
let manager = AFHTTPRequestOperationManager()
manager.securityPolicy.allowInvalidCertificates = true
I'm now using Swift 2.0 in Xcode 7 and consistent getting errors regarding invalid certificate. I updated to the latest AFNetworking, 2.6.0 and continue getting the errors despite the following configuration:
manager.securityPolicy.allowInvalidCertificates = true
manager.securityPolicy.validatesDomainName = false
The error I'm getting is
An SSL error has occurred and a secure connection to the server cannot be made.
We're only using the self signed certificate temporarily for the next few days. Pinning is not desired.
Edit: This question specifically deals with Swift 2.0 and Xcode 7 using AFNetworking. Use of Xcode 7 implies that iOS 9 is used as the target OS by default. My issue did turn out to be Apple's new App Transport Security, but it did not appear during search and is not obvious given the switch to Swift 2.0. AFNetworking also changed their security policy between releases 2.5.4 and 2.6 requiring additional configuration to support self signed certificates.