iOS 11, iPhone 6 plus에서 내 앱 속도가 느려질 수 있습니다. (다른 iOS가 예상대로 실행됩니다.)iOS 11에서 SecTrustEvaluate() 속도가 느려집니다.
SecTrustEvaluate() 메소드가 앱 속도를 늦추는 이유입니다. 주 스레드에서 실행할 때 약 3 초가 걸립니다. 그래서 gcd를 사용하여 백그라운드 스레드로 이동합니다.
- (void)URLSession:(NSURLSession *)session didReceiveChallenge(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
BOOL allowConnect = //Server Trust Evaluation in here
dispatch_async(dispatch_get_main_queue(), ^{
if (allowConnect) {
//completionHandler;
} else {
//cancel
}
});
});
}
}
그런 다음 UI를 차단하지 않지만 서버 신뢰 유효성 검사에는 20 초가 걸립니다.
누군가이 문제를 알고 있습니까? 도와주세요. 감사.