Alamofire在swift5下无条件信任证书

2020-05-21  本文已影响0人  CicadaJZ
extension ViewController : URLSessionDelegate {
    public func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
        let urlCredential = URLCredential(trust: challenge.protectionSpace.serverTrust!)
        completionHandler(.useCredential, urlCredential)
    }
}
上一篇 下一篇

猜你喜欢

热点阅读