我的一個應用程序無法連接到它的API服務器。記錄的原因是NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
。到目前爲止,沒有找到爲什麼或什麼的運氣,但最令人沮喪的是,這個問題出現在我的一些測試設備上。在其他一切都很好。我使用NSURLConnection:sendSynchronousRequest:returningResponse:error:
,但經過一些重構並嘗試使用NSURLSessionDataTask:dataTaskWithRequest:completionHandler:
後,問題仍然存在。 還增加NSURLSession/NSURLConnection HTTP加載失敗(kCFStreamErrorDomainSSL,-9813)錯誤不是所有的iPhone?
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
{
completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
}
,仍然沒有.....
附:即使我的第一個問題是許多其他問題的重複,但我主要關心的是爲什麼這個錯誤只出現在我的一個測試設備上(在設置 - >常規 - >重置工作正常後,但如何告訴Apple「請重置您的測試設備「?)。其他工作非常好。
的可能的複製[CFNetwork的SSLHandshake失敗的iOS 9](http://stackoverflow.com/questions/30720813/cfnetwork-sslhandshake -failed-ios-9) – FelixSFD
@FelixSFD,你可以查看我的編輯:) – user3352185