Marino Faggiana 8 年之前
父節點
當前提交
b6c327cd5b
共有 1 個文件被更改,包括 7 次插入6 次删除
  1. 7 6
      iOSClient/Networking/OCNetworking.m

+ 7 - 6
iOSClient/Networking/OCNetworking.m

@@ -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