0

I have set- Allow Arbitrary loads to YES

And I am using the following code to fire a request:

let apiAddress = somehttpsAddress
let configuration = URLSessionConfiguration.default
configuration.timeoutIntervalForRequest = 30 // seconds
configuration.timeoutIntervalForResource = 30 //seconds
AFManager = Alamofire.SessionManager(configuration: configuration)
AFManager.request(apiAddress , method: .post, parameters: body, encoding: JSONEncoding.default, headers: header).responseJSON { response in
            // utility
}

However all I get is these errors:

TIC SSL Trust Error [1:0x60c000161c80]: 3:0
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)

I don't understand what's missing here and how should I correct this. Please help me in correcting this.

  • You might want to check this thread https://github.com/Alamofire/Alamofire/issues/2512#issuecomment-387428459 – Xchord Sep 27 '18 at 07:21
  • @Xchord, does that mean I cant do the same? –  Sep 27 '18 at 07:36
  • The Alamofire doesn't support it yet. You can use URLSession as discussed here https://forums.developer.apple.com/thread/92231or configure the authentication properly on the server side. – Xchord Sep 27 '18 at 07:41

2 Answers2

0

If you are connected to some public network or maybe campus network, they may have installed some restrictions softwares for instance Cyberoam. The address on which you are making request might be restricted. you can ask for the permission to access that particular site.

Raj Salla
  • 75
  • 8
0

the problem here is that Alamofire think it's not a valid ssl certificate. Try to use this as your manager:

    private static var Manager : Alamofire.SessionManager = {
    // Create the server trust policies
    let serverTrustPolicies: [String: ServerTrustPolicy] = [
        "your domain goes here": .disableEvaluation
    ]
    // Create custom manager
    let configuration = URLSessionConfiguration.default
    configuration.httpAdditionalHeaders = Alamofire.SessionManager.defaultHTTPHeaders
    let man = Alamofire.SessionManager(
        configuration: URLSessionConfiguration.default,
        serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies)
    )
    return man
}()
MarcoCarnevali
  • 671
  • 8
  • 23