From 5c237a66ebf389d38fca6d52b5d8dc7718a0e30a Mon Sep 17 00:00:00 2001 From: Josh Chung Date: Mon, 14 Apr 2014 17:13:24 +0900 Subject: [PATCH] call SecTrustEvaluate before calling SecTrustGetCertificateCount SecTrustGetCertificateCount's documentation says SecTrustEvaluate must be called before calling it. Without calling it, SecTrustGetCertificateCount returns 0 in OS X 10.7. --- AFNetworking/AFURLConnectionOperation.m | 1 + 1 file changed, 1 insertion(+) diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index fc60600..e483f3e 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -592,6 +592,7 @@ willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challe SecTrustRef serverTrust = challenge.protectionSpace.serverTrust; SecPolicyRef policy = SecPolicyCreateBasicX509(); + SecTrustEvaluate(serverTrust, NULL); CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust); NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:certificateCount];