23

When I use Xcode 9.0 download Simulator (Xcode - Preferences - Components - Simulator), It will show "Could not download and install iOS 8.1 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."
enter image description here

More detail problem

I found that I can download the simulator for iOS10.0 and above, but I can not download the simulator below iOS 10.0. As you can see:

  • When I click to download the simulator above iOS 10.0, it's work.
  • But when I download an emulator below the iOS 10.0 version, it will display a warning.

enter image description here

I have tried this solution:

  1. Copy the download address of the .dmg suffix(https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_2-9.2.1.1451951473.dmg from @Mesut GÜNEŞ answer) and open it in the Safari browser.
  2. The browser will displays a warning show that the server certificate is invalid and automatically disables the continued access to the URL. enter image description here
  3. Click "visit the site" and now i can download the simulator installation package on the browser.
  4. After the installation package is downloaded, drag the installation package to the cache. directory(/Users/Andy/Library/Caches/com.apple.dt.Xcode/Downloads
  5. Open Xcode-Preferences to download and install the Simulator.
  6. So it just put the installation package into the cache directory in advance, in order to download faster. But the problem is that this warning window prevents me from starting the download. Even if I downloaded the installation package, but I still can't install it.
andy0570
  • 574
  • 5
  • 13

3 Answers3

21

I actually found another way, if you're fine with updating your certificate trust settings. Browse to https://devimages.apple.com.edgekey.net/downloads/xcode/simulators in Safari. You'll see this:

This Connection Is Not Private

If you click on "visit this website", then it will prompt you for admin credentials to update your certificate trust settings. After doing that, the download links work in Xcode like normal.

Dov
  • 15,530
  • 13
  • 76
  • 177
16

Seems like network issue, you can check the log and download the related .dmg file via browser. See the log:

sudo /Applications/Xcode.app/Contents/MacOS/Xcode
Password:
2017-09-27 09:35:05.531 Xcode[24753:3375917] plugin com.apple.dt.XCDocumenter.XCDocumenterExtension interrupted
2017-09-27 09:35:05.567 Xcode[24753:3376388] Hub connection error Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.dt.XCDocumenter.XCDocumenterExtension" UserInfo={NSDebugDescription=connection to service named com.apple.dt.XCDocu
), NSUnderlyingError=0x7fb6702b4c00 {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_2-9.2.1.1451951473.dmg, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFNetworkCFStreamSSLErrorOriginalValue=-9813, kCFStreamPropertySSLPeerCertificates=(
    "<SecCertificate 0x7fb674e40f80 [0x7fff78314440]>",
    "<SecCertificate 0x7fb674ef4770 [0x7fff78314440]>"
), _kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrust 0x7fb674da1550 [0x7fff78314440]>, 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_2-9.2.1.1451951473.dmg, _kCFStreamErrorCodeKey=-9813}}, 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_2-9.2.1.1451951473.dmg, NSErrorFailingURLStringKey=https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_2-9.2.1.1451951473.dmg, NSErrorClientCertificateStateKey=0}
2017-09-27 10:05:14.344 Xcode[24909:3382580] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
2017-09-27 10:05:14.513 Xcode[24909:3382580] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
  1. dowloandable link in the log: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_2-9.2.1.1451951473.dmg

  2. move the downloaded .dmg file to com.apple.dt.Xcode/Downloads directory. To do this open ~/Library/Caches in finder and show com.apple.dt.Xcode and go to Downloads.

Note: com.apple.dt.Xcode isn’t a true “directory”. It's a package. But we can still access it’s contents by right clicking on the file and clicking “Show Package Contents”

  1. Open Xcode->Preferences->Component and click related simulator to continue installation with downloaded file

Optional: Restart Xcode if it still gives error of private connection & do step 3.

BIBD
  • 15,107
  • 25
  • 85
  • 137
Mesut GUNES
  • 7,089
  • 2
  • 32
  • 49
  • Thanks for the solution. I got the dmg path but its not allowing me to download. Any suggestion should i download. (error while downloading dmg is: This connection is not private). – JiteshW Sep 29 '17 at 16:04
  • Bottom of the page there sbould be link to continue. Click on. Advanced and then proceed – Mesut GUNES Sep 29 '17 at 16:06
  • Which browser you are using, in safari its not showing me only 2 buttons - Show details and Go back – JiteshW Sep 29 '17 at 16:26
  • Can I safe delete the downloaded dmg file after adding in Xcode? – feca Sep 29 '17 at 16:49
  • 1
    @FerencKiss I think so – Mesut GUNES Sep 29 '17 at 16:51
  • @JiteshW in 3rd step you install the .dmg file you had downloaded and moved to the path in step two. Therefore you need to open xcode and then components so that you can continue installation by xcode – Mesut GUNES Sep 29 '17 at 19:27
  • Yes, I did that. Hence I deleted that dumb comment :). But even after installation the error is still there. :( – JiteshW Sep 29 '17 at 19:35
  • 3
    Looks like restarting machine fixed that. Thanks mate !! – JiteshW Sep 29 '17 at 19:39
  • For the next guy... here's the 9.3 version - https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg (you can remove the 's' from https to get around the certificate error. – BIBD Oct 05 '17 at 17:34
3

I had same issue few months back, and the problem was with my Network (in my case, access to various sites were blocked in office).

I switched to another network and download necessary simulators. (My colleagues also had the same issue and above solution works)

Try to change your network and make sure that you are not connected with any proxy server.

Hope this will help you out.

iLearner
  • 1,670
  • 2
  • 19
  • 45
  • 2
    I have try to switch from the company's network to the home network, and even use the iPhone's cellular network, it still not work. it seems that the official server certificate expired reasons. – andy0570 Sep 27 '17 at 13:53