Alamofire无法获得用于客户端认证的NSURLAuthenticationMethodClientCertificate

时间:2018-10-17 07:25:10

标签: swift ssl alamofire mutual-authentication

我使用Alamofire(4.7.3),Xcode 10(Swift4.2)。我使用这些代码进行相互认证

manager.delegate.sessionDidReceiveChallenge = { (session,challenge) in
    if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust {
            // it's ok
    }
    else if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodClientCertificate {
           // can't receive NSURLAuthenticationMethodClientCertificate
    }
)

0 个答案:

没有答案