I'm trying to connect to a self-signed HTTPS server on iOS 9.1.
I'm using :
[NSURLConnection sendSynchronousRequest:request returningResponse:nil error:&error];
And I get an error saying that the certificate is not valid:
Error Domain=NSURLErrorDomain Code=-1202 "<French error saying the certificate is invalid"
UserInfo=
{NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x13c768140>,
NSLocalizedRecoverySuggestion=<French recovery suggestion asking if the user wants to connect anyway>, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9813, NSErrorPeerCertificateChainKey=<CFArray 0x13d82ffe0 [0x1a1242b68]>
I've tried adding all possible transport security exceptions, my current attempt is:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>mydomain.org</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
I've also tried NSAllowsArbitraryLoads
but even that doesn't work.
I have several .plist files (cocoapods and tests), I think it's in the correct one (App/Supporting Files/Info.plist).
Any idea of what could be wrong?