-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
if ([protectionSpace authenticationMethod] == NSURLAuthenticationMethodServerTrust) {
// do something
} else if ([protectionSpace authenticationMethod] == NSURLAuthenticationMethodClientCertificate) {
// Do something
}
}
在iOS 10中,响应返回
NSURLProtectionSpace* protectionSpace = challenge.protectionSpace;
NSURLAuthenticationMethodClientCertificate
问题在于iOS 11中的响应返回:
NSURLAuthenticationMethodServerTrust
NSURLAuthenticationMethodClientCertificate
第一本书,而不是
NSURLAuthenticationMethodServerTrust
感谢您的帮助:)