(即将被弃用)NSURLConnectionDelegate 允许您像这样处理 TLS 信任挑战:
-(void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge(NSURLAuthenticationChallenge *)challenge
{
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
[challenge.sender performDefaultHandlingForAuthenticationChallenge:challenge];
}
假设同一台服务器提供相同的 x509 证书,我的测试表明此方法的效果在应用程序执行期间被缓存。此方法不再打。
有没有办法在处理发生后强制应用程序忘记此方法的效果,以便随后对同一 Web 服务的命中强制调用此方法?