|
@@ -1613,12 +1613,13 @@
|
|
|
- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
|
|
|
{
|
|
|
// The pinnning check
|
|
|
-
|
|
|
- if ([[CCCertificate sharedManager] checkTrustedChallenge:challenge]) {
|
|
|
- completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
|
|
|
- } else {
|
|
|
- completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
|
|
|
- }
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ if ([[CCCertificate sharedManager] checkTrustedChallenge:challenge]) {
|
|
|
+ completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
|
|
|
+ } else {
|
|
|
+ completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
@end
|