Could not download and install iOS 9.3 Simulator. The certificate for this server is invalid. You might be connecting to a server that is pretending to be “devimages.apple.com.edgekey.net” which could

升级到Xcode9.0以后,去下载模拟器,发现提示“Could not download and install iOS 9.3 Simulator. The certificate for this server is invalid. You might be connecting to a server that is pretending to be “devimages.apple.com.edgekey.net” which could put your confidential information at risk.”的错误

看起来是个https证书验证的问题,那怎么做呢?

  1. 通过终端命令打开Xcode
sudo /Applications/Xcode.app/Contents/MacOS/Xcode
  1. 打开下载模拟器的窗口Xcode-Preferences-Components点击iOS9.3 Simulator,弹出窗口,提示警告。
  2. 查看终端的输出
2017-09-30 13:43:09.368 Xcode[3443:318102] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9843)
2017-09-30 13:43:09.372 Xcode[3443:318051] [MT] DVTDownloadable: Error Domain=NSURLErrorDomain Code=-1202 "Could not download and install iOS 9.3 Simulator. The certificate for this server is invalid. You might be connecting to a server that is pretending to be “devimages.apple.com.edgekey.net” which could put your confidential information at risk." UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSErrorFailingURLKey=https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg, NSErrorFailingURLStringKey=https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg, NSErrorPeerCertificateChainKey=(
    "",
    ""
), NSErrorClientCertificateStateKey=0, NSLocalizedDescription=Could not download and install iOS 9.3 Simulator. The certificate for this server is invalid. You might be connecting to a server that is pretending to be “devimages.apple.com.edgekey.net” which could put your confidential information at risk., _kCFStreamErrorDomainKey=3, NSUnderlyingError=0x7f9c41374bc0 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “devimages.apple.com.edgekey.net” which could put your confidential information at risk." UserInfo={NSErrorFailingURLStringKey=https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFNetworkCFStreamSSLErrorOriginalValue=-9843, kCFStreamPropertySSLPeerCertificates=(
    "",
    ""
), _kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “devimages.apple.com.edgekey.net” which could put your confidential information at risk., _kCFStreamErrorDomainKey=3, NSErrorFailingURLKey=https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg, _kCFStreamErrorCodeKey=-9843}}, _kCFStreamErrorCodeKey=-9843}
2017-09-30 13:43:09.372 Xcode[3443:318066]  DVTDownloadable: Download Failed. Downloadable: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg. Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “devimages.apple.com.edgekey.net” which could put your confidential information at risk." UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9843, NSErrorPeerCertificateChainKey=(
    "",
    ""
), NSUnderlyingError=0x7f9c41374bc0 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “devimages.apple.com.edgekey.net” which could put your confidential information at risk." UserInfo={NSErrorFailingURLStringKey=https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFNetworkCFStreamSSLErrorOriginalValue=-9843, kCFStreamPropertySSLPeerCertificates=(
    "",
    ""
), _kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “devimages.apple.com.edgekey.net” which could put your confidential information at risk., _kCFStreamErrorDomainKey=3, NSErrorFailingURLKey=https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg, _kCFStreamErrorCodeKey=-9843}}, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “devimages.apple.com.edgekey.net” which could put your confidential information at risk., NSErrorFailingURLKey=https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg, NSErrorFailingURLStringKey=https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg, NSErrorClientCertificateStateKey=0}
2017-09-30 13:55:29.805 Xcode[3443:318051] Unknown class GPUTesselationSliderCell in Interface Builder file.
2017-09-30 13:55:34.791 Xcode[3443:318051] Could not find image named 'DVTInFieldChooseButtonSmall'.
2017-09-30 13:55:35.089 Xcode[3443:318051] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-13247/IDEKit/NavigableItems/IDENavigableItem.m:1175
Details:  No match from )> to . Iterating the whole tree might have taken a significant amount of time.
Object:   
Method:   -_descendantItemForRepresentedObject:stopAtClass:
Thread:   {number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
  1. 查看输出的下载地址https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg,将下载地址 copy到浏览器中,发现提示
    Could not download and install iOS 9.3 Simulator. The certificate for this server is invalid. You might be connecting to a server that is pretending to be “devimages.apple.com.edgekey.net” which could_第1张图片
    截图-1.png

    点击访问此网站,既可以下载模拟器文件
  2. 将下载好的文件*.dmg拖到com.apple.dt.Xcode/Downloads文件夹中,通过终端open ~/Library/Caches,找到com.apple.dt.Xcode,点击右键,选择显示包内容,如果里面没有Downloads文件夹,则新建,完成后,将*.dmg拖到这里面
  3. 回到窗口Xcode-Preferences-Components,再次点击刚才点击过的iOS9.3 Simulator直接跳过下载,直接安装了。
  4. 在安装其他版本的模拟器,就可以直接在Xcode-Preferences-Components点击就能下载了,这算不算Apple的bug呢。

你可能感兴趣的:(Could not download and install iOS 9.3 Simulator. The certificate for this server is invalid. You might be connecting to a server that is pretending to be “devimages.apple.com.edgekey.net” which could)