2016-12-19 85 views
3

您好我收到以下錯誤:域= NSURLErrorDomain代碼1202

Error Domain=NSURLErrorDomain Code=-1202 \"The certificate for this server is invalid. You might be connecting to a server that is pretending to be 「server-prod.name-cloud.com」 which could put your confidential information at risk.\" UserInfo={NSErrorFailingURLStringKey= https://server-prod.name-cloud.com /v3/project/session/926B9E6BE31B/, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, NSErrorFailingURLKey= https://server-prod.name-cloud.com /v3/project/session/926B9E6BE31B/, _kCFStreamErrorCodeKey=-9843, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be 「server-prod.name-cloud.com」 which could put your confidential information at risk.}

我讀了所有的relevant docs,我們適用於「常見故障」部分中的所有要求。

更多細節:

  • 只能從德國收到的錯誤(除4倍,在過去2W,這是來自意大利)
  • 它不是房子重複性噸重試後
  • 最終上傳去扔
  • 這是收到展臺的iOS 10.XX & 9.xx
  • 我用Amazon的服務器與2016-08 SSL Security Policies, 所以要根據apple應該OK

在應用中使用:

<key>NSAppTransportSecurity</key> 
    <dict> 
     <key>NSAllowsArbitraryLoads</key> 
    <true/> 
</dict> 

說明 - 在生產中我總是使用HTTP的,我離開NSAllowsArbitraryLoads因爲一些測試離岸可潰敗切換到HTTP進行調試。

+0

您看過[[http://lithium3141.com/blog/2015/08/21/shipping-an-app-with-app-transport-security/](http://lithium3141.com/blog/ 2015/08/21/shipping-an-app-with-app-transport-security /) –

回答

9

對於在本地使用服務器並需要讓iOS模擬器信任證書的開發者而言。請按照下列步驟操作:

  1. 通過從鑰匙串導出證書獲取.cer文件。您需要有效格式的證書文件,最簡單的方法是通過 將其從鑰匙串中導出。

  2. 將上述.cer文件拖放到模擬器上。它應該給你一個安裝「配置文件」的提示。繼續並按照說明進行安裝。

  3. 對於那些正在使用最新版本的XCode和iOS模擬器的人。你需要做最後一步1。必須明確告訴模擬器信任根CA.做到這一點,去General -> About -> Certificate Trust Settings -> "Enable Full Trust for Root Certificate" for your particular certificate

希望這可以節省一些人的頭痛!

+0

哇,你只是保存了我的理智 –

+0

運行ios 10.3的模擬器上沒有「啓用完全信任根證書」選項 –

+0

在我的情況下,「爲根證書啓用完全信任」的選項僅出現在根證書上,它不出現在中間證書或證書證書上 –

相關問題