Steven vor 1 Jahr
Ursprung
Commit
a2e4a5665e

+ 3 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSBaseWKWebViewController.m

@@ -1078,6 +1078,9 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
                 completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
             }
         }
+        else {
+            completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
+        }
     });
 }
 

+ 12 - 6
KulexiuForTeacher/KulexiuForTeacher/Module/TXClassRoom/View/NewWhiteboard/KSNewWhiteBoard.m

@@ -247,14 +247,20 @@
 
 - (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *_Nullable))completionHandler
 {
-    if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
-        if (challenge.previousFailureCount == 0) {
-            NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
-            completionHandler(NSURLSessionAuthChallengeUseCredential, credential);
-        } else {
+    dispatch_queue_t queue =  dispatch_queue_create("webViewChallengeQueue", NULL);
+    dispatch_async(queue, ^{
+        if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
+            if (challenge.previousFailureCount == 0) {
+                NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
+                completionHandler(NSURLSessionAuthChallengeUseCredential, credential);
+            } else {
+                completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
+            }
+        }
+        else {
             completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
         }
-    }
+    });
 }
 #pragma mark - WKScriptMessageHandler
 - (void)userContentController:(WKUserContentController *)userContentController