iOS 9 ATS SSL error with supporting server

后端 未结 5 561
余生分开走
余生分开走 2020-12-07 23:10

I installed Xcode 7 and tried running my app under iOS 9. I\'m getting the infamous error: Connection failed! Error - -1200 An SSL error has occurred and a secure conn

5条回答
  •  醉酒成梦
    2020-12-07 23:57

    In iOS9, Apple added new feature called App Transport Security(ATS).

    ATS enforces best practices during network calls, including the use of HTTPS.

    Apple Pre-release documentation:

    ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt. You should adopt ATS as soon as possible, regardless of whether you’re creating a new app or updating an existing one.

    If you’re developing a new app, you should use HTTPS exclusively. If you have an existing app, you should use HTTPS as much as you can right now, and create a plan for migrating the rest of your app as soon as possible.

    Add Below key in your info.plist & then see.

    NSAppTransportSecurity
    
        NSAllowsArbitraryLoads
        
    
    

    Even you can add specific exception,

    NSAppTransportSecurity
    
        NSExceptionDomains
        
            testdomain.com
            
                NSIncludesSubdomains
                
                NSExceptionAllowInsecureHTTPSLoads
                
                NSExceptionRequiresForwardSecrecy
                
                NSExceptionMinimumTLSVersion
                TLSv1.2
                NSThirdPartyExceptionAllowInsecureHTTPSLoads
                
                NSThirdPartyExceptionRequiresForwardSecrecy
                
                NSThirdPartyExceptionMinimumTLSVersion
                TLSv1.2
                NSRequiresCertificateTransparency
                
            
    
            ...
    
        
    
    

提交回复
热议问题