0

I am using mutual authentication in iOS 10 that with if statement bellow mutual authentication works correctly.

-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
  if ([protectionSpace authenticationMethod] == NSURLAuthenticationMethodServerTrust) {

// do something

} else if ([protectionSpace authenticationMethod] == NSURLAuthenticationMethodClientCertificate)  {

// Do something

}
}

In iOS 10 the response return with

 NSURLProtectionSpace* protectionSpace = challenge.protectionSpace;

NSURLAuthenticationMethodClientCertificate

And the problem is in iOS 11 the response return:

NSURLAuthenticationMethodServerTrust

How to force it that response return NSURLAuthenticationMethodClientCertificate the first tome instead of NSURLAuthenticationMethodServerTrust.

Appreciate any help :)

Steven
  • 762
  • 1
  • 10
  • 27

1 Answers1

0

I am going to answer it here after some hours research. In iOS 11 NSURLAuthenticationMethodServerTrust always arrive first then pass to NSURLAuthenticationMethodClientCertificate but in iOS 10 it work in opposite.

Steven
  • 762
  • 1
  • 10
  • 27