'SessionDelegate.swift file did not implement URLSessionDelegate's session didReceive challenge

I was using Charles with Alamofire but get a -999 error, howerver AFNetworking works well, I found that AFNetworking implemented urlSession:didReceiveChallenge Alamofire did not, is there any reason for that?



Solution 1:[1]

Alamofire instead implements urlSession(_:task:didReceive:completionHandler:) which operates at the URLSessionTask-level rather than the URLSession-level. This allows Alamofire to more easily offer per-Request authentication errors when implementing certificate pinning.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jon Shier