升级到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证书验证的问题,那怎么做呢?
- 通过终端命令打开Xcode
sudo /Applications/Xcode.app/Contents/MacOS/Xcode
- 打开下载模拟器的窗口
Xcode-Preferences-Components
点击iOS9.3 Simulator
,弹出窗口,提示警告。 - 查看终端的输出
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=<SecTrustRef: 0x7f9c412b1dc0>, 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=(
"<cert(0x7f9c5e340200) s: *.test.edgekey.net i: Symantec Class 3 Secure Server CA - G4>",
"<cert(0x7f9c5e340c00) s: Symantec Class 3 Secure Server CA - G4 i: VeriSign Class 3 Public Primary Certification Authority - G5>"
), 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=(
"<cert(0x7f9c5e340200) s: *.test.edgekey.net i: Symantec Class 3 Secure Server CA - G4>",
"<cert(0x7f9c5e340c00) s: Symantec Class 3 Secure Server CA - G4 i: VeriSign Class 3 Public Primary Certification Authority - G5>"
), _kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x7f9c412b1dc0>, 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=<SecTrustRef: 0x7f9c412b1dc0>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9843, NSErrorPeerCertificateChainKey=(
"<cert(0x7f9c5e340200) s: *.test.edgekey.net i: Symantec Class 3 Secure Server CA - G4>",
"<cert(0x7f9c5e340c00) s: Symantec Class 3 Secure Server CA - G4 i: VeriSign Class 3 Public Primary Certification Authority - G5>"
), 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=(
"<cert(0x7f9c5e340200) s: *.test.edgekey.net i: Symantec Class 3 Secure Server CA - G4>",
"<cert(0x7f9c5e340c00) s: Symantec Class 3 Secure Server CA - G4 i: VeriSign Class 3 Public Primary Certification Authority - G5>"
), _kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x7f9c412b1dc0>, 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 <IDEKeyDrivenNavigableItem 0x7f9c5cb31960: (supports Any NSObject, represents: <Xcode3EditingGroup: 0x7f9c597a7200>)> to <Xcode3Target:0x7f9c5975de00:TestProject>. Iterating the whole tree might have taken a significant amount of time.
Object: <IDEKeyDrivenNavigableItem_Xcode3EditingGroup_Any: 0x7f9c5cb31960>
Method: -_descendantItemForRepresentedObject:stopAtClass:
Thread: <NSThread: 0x7f9c50407620>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
- 查看输出的下载地址
https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg
,将下载地址 copy到浏览器中,发现提示
点击访问此网站,既可以下载模拟器文件 - 将下载好的文件
*.dmg
拖到com.apple.dt.Xcode/Downloads
文件夹中,通过终端open ~/Library/Caches
,找到com.apple.dt.Xcode
,点击右键,选择显示包内容
,如果里面没有Downloads文件夹,则新建,完成后,将*.dmg
拖到这里面 - 回到窗口
Xcode-Preferences-Components
,再次点击刚才点击过的iOS9.3 Simulator
直接跳过下载,直接安装了。 - 在安装其他版本的模拟器,就可以直接在
Xcode-Preferences-Components
点击就能下载了,这算不算Apple的bug呢。