Search code examples
iosobjective-cswifthttpsapp-transport-security

moving from HTTP to HTTPS errors: -9801 and -1200


I had an app working with http requests totally fine. Now the server has moved to https therefore I need to make some changes with ATS settings.

It gives the following error:

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9801)

Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and 
a secure connection to the server cannot be made." 
UserInfo={NSLocalizedDescription=An SSL error has occurred and 
a secure connection to the server cannot be made.,
 NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, 
_kCFStreamErrorCodeKey=-9801, 
NSErrorFailingURLStringKey=https://domain.com, 
_kCFStreamErrorDomainKey=3, NSUnderlyingError=0x79094840

I have tried to set Allow Arbitrary Loads to YES. But it didn't work. Please advise what setting do I need to set for it to work.


Solution

  • Fixed by removing server's domain from exceptions domains list. As it was in exception list for working with http.