2

(kCFStreamErrorDomainSSL, -9813) 실패 -NSURLSession /있는 NSURLConnection HTTP 부하가 HTTPS 요청을하는 동안 오류가 직면하고 오류

NSURLSession /있는 NSURLConnection HTTP로드 (kCFStreamErrorDomainSSL, -9813)에 실패했습니다.

는 좀 구글을했고, 내 프로젝트 정보 PLIST 파일에서 다음 키를 언급하여 ATS (응용 프로그램 전송 보안을) 통과에 의해 언급 한 몇 가지 해결책이 있었다. 이것이 iOS9 이상의 문제입니다.

** 키는 다음과 같습니다 -

키 - NSAppTransportSecurity

값 : -NSAllowsArbitraryLoads : 사실 나는이 솔루션을 시도

**. 그러나 나는 여전히 같은 문제에 항상 직면 해있다. 나는 이것에 붙어있다. 아무도 나를 도울 수 있습니까?

+0

은 분명히이 iOS 버전에서 일어나는 것은> (10) 수정을 위해 그것은 다음 링크 https://stackoverflow.com/questions/31249559/react-native-xmlhttprequest-request-fails-if-ssl-https를 따라 -certificate-is-not-vali – jose920405

답변

0

info.plist 파일의 NSAppTransportSecurity 사전에 NSAllowsArbitraryLoads 키를 YES에 추가해야합니다.

enter image description here

+0

답장을 보내 주셔서 감사합니다. @Bhumika. 그러나 나는 이미이 해결책을 시도했다. 그것은 작동하지 않습니다. –

+0

위험 할 수 있습니다. 또한 애플은이 솔루션을 사용하면 앱 리뷰를 실행할 수 있다고 말합니다. [출처] (https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/ uid/TP40009251-SW59) – franiis

0

나는 NSURLConnction의 인증 요청의 대리자 메서드를 구현하여 내 문제를 해결했습니다.

구현 후 내 문제가 해결되었습니다.

- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { 
     NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; 
     [challenge.sender useCredential:credential forAuthenticationChallenge:challenge]; 

     [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge]; 
} 
관련 문제