NSURLSession "HTTP load failed kCFStreamErrorDomainSSL, -9813 ; Self signing certificate

后端 未结 7 1342
长情又很酷
长情又很酷 2020-12-04 21:42

I\'m trying to connect my iOS app to an HTTPS Rails app which is currently run on a local host in my network. I can access the site from my browser with https://myIP:3

7条回答
  •  既然无缘
    2020-12-04 22:30

    If I understood well, Apple now wants the developers to use HTTPS and TLS 1.2 for network calls.

    Temporary, you can add this in your "Info.plist" file :

    NSAppTransportSecurity
    
        NSAllowsArbitraryLoads
        
    
    

    Just have a look to this link, it may also help you : http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/

    --

    Update : Following some comments the above solution is not anymore working. Here is an updated solution.

    1. Go to your Info.plist file.
    2. Add a row of Type Dictionary and of Key App Transport Security Settings.
    3. In this Dictionary, add a row of Type Boolean, of Key Allow Arbitrary Loads and of Value YES

    -

    Otherwise you can set Domain Exceptions. This is how to do :

    1. Go to your Info.plist file.
    2. Add a row of Type Dictionary and of Key App Transport Security Settings.
    3. Add a row of Type Dictionary and of Key Exception Domains.
    4. Add a row of Type Dictionary and of Key The domain.
    5. Add two rows of Type Boolean and of Key NSExceptionAllowsInsecureHTTPLoads & NSIncludesSubdomains with Value to YES.

    Links

    https://forums.developer.apple.com/message/5857#5857

    2015 WWDC Session 711

    iOS 9 HTTP Connection Error - StackOverflow

提交回复
热议问题