2017-10-04 1 views
1

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 초가 걸립니다.
누군가이 문제를 알고 있습니까? 도와주세요. 감사.

답변

0

문제점을 구성합니다. 이것은 iOS 11과 관련이 없습니다. 내 잘못입니다.

같은 호스트에서 각 보안 다운로드 이미지 요청에 대해 하나의 NSURLSession을 만듭니다. TLS 세션이 계산 비용이 많이 들기 때문에 내 앱이 느려지 게됩니다. 내 솔루션은 모든 다운로드 요청에 대해 하나의 세션 만 만듭니다. 이렇게 평가 된 서버 인증서의 결과는 캐시 될 것이고 다음 요청 (동일한 호스트, 포트에서)은 평가 서버를 신뢰하지 않아도됩니다.

상세 정보 : https://developer.apple.com/library/content/qa/qa1727/_index.html

Why is a HTTPS NSURLSession connection only challenged once per domain?

관련 문제