iOS app with self-signed SSL certificates NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)

I have attempted to point my iOS client to a self-signed host on our local network but I keep on getting SSL Error's
 
I have updated my Info.plist file as follows
 

<key>NSAppTransportSecurity</key>

<dict>

    <key>NSAllowsArbitraryLoads</key>

    <true/>

</dict>

 
And added serverTrustPolicies instance to the init of the MooManager which got me passed "https://
INTERNAL.HOST.com/api/auth/token" but it appears i'm still getting the error attached

 
open class AlamofireService : NSObject {
    var privateSession:MooManager?
    // Mark: init
    override init() {
        super.init()
        var defaultHeaders = SessionManager.defaultHTTPHeaders
 
        defaultHeaders["User-Agent"] = (defaultHeaders["User-Agent"]! as String) + " mooIOS/1.0"
        
        let configuration = URLSessionConfiguration.ephemeral
        configuration.httpAdditionalHeaders = defaultHeaders
        
        let serverTrustPolicies: [String: ServerTrustPolicy] = [
            "INTERNAL.HOST.com": .disableEvaluation
        ]
       
        //privateSession = MooManager(configuration: configuration )
        
        privateSession = MooManager(configuration: configuration, serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies) )
    }
    // Mark: Singleton
    class var sharedInstance : AlamofireService {
        struct Singleton {
            static let instance = AlamofireService()
        }
        
        // Return singleton instance
        return Singleton.instance
    }
}

55FoxSupport Basic on 02/16/17 at 10:34 Edited in IOS app
2 Answer(s)
INTERNAL.HOST.com is a placeholder it is being hosted within our corporate network
55FoxSupport Basic on 02/21/17 at 10:22
INTERNAL.HOST.com is not correct . Where is the hosting ? If it's in your pc , you can try IP address : 127.0.0.1 ( for testing on iOS Simulator ) or your IP on LAN ( for testing on real device )
Duy Duy (mooTechnicalTeam) Basic on 02/20/17 at 23:08
Cookies on mooCommunity - Social Networking Script.
This site uses cookies to store your information on your computer.