美文网首页
Alamofire在swift5下无条件信任证书

Alamofire在swift5下无条件信任证书

作者: CicadaJZ | 来源:发表于2020-05-21 14:00 被阅读0次
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)
    }
}

相关文章

网友评论

      本文标题:Alamofire在swift5下无条件信任证书

      本文链接:https://www.haomeiwen.com/subject/ecmzohtx.html