xcpretty / xcode-install

🔽 Install and update your Xcodes
https://fastlane.tools
MIT License
2.58k stars 237 forks source link

Xcode 14 simulator list blank #466

Open mzsanford opened 1 year ago

mzsanford commented 1 year ago

While working on a Fastlane / CircleCI setup for some new iOS 16 features I found I was unable to install a simulator.

$ gem install xcode-install && xcversion simulators --install="14.5" && xcrun simctl create 'iPhone 12 (14.5)' com.apple.CoreSimulator.SimDeviceType.iPhone-12 com.apple.CoreSimulator.SimRuntime.iOS-14-5
Successfully installed xcode-install-2.8.1
1 gem installed
[!] No simulator matching 14.5 was found. Please specify a version from the following available simulators:
Xcode 14.0 (/Applications/Xcode-14.0.app)

Exited with code exit status 1

I was also able to replicate this locally with Xcode 14 where my Xcode is showing the iOS 14.5 simulator in question installed. Tracing through xcode-install I found it is requesting the simulator list from https://devimages-cdn.apple.com/downloads/xcode/simulators/index-14.0.0-AF3613FA-81D9-4A8B-8204-9912665677FA.dvtdownloadableindex in InstalledXcode#available_simulators. It appears that URL is invalid and provides a standard AWS permissions error:

$ curl -Ls https://devimages-cdn.apple.com/downloads/xcode/simulators/index-14.0.0-AF3613FA-81D9-4A8B-8204-9912665677FA.dvtdownloadableindex
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>655A17VAM6GKQD6C</RequestId><HostId>I4RaiX9CMvnlJ/K1juQ1HIsIvpOn9NSR1BoJUI3PrTcGtBV7uMPpDxzQiRf2awmlNWqnd/vcio0=</HostId></Error>%

It is unclear to me if this is an Apple "error" or if something has changed with Xcode 14 creating a bug in xcode-install. Whichever is the case it appears XcodeInstall is swallowing the error.

mzsanford commented 1 year ago

I fired up Proxyman and found that Xcode 14 requested the list from https://devimages-cdn.apple.com/downloads/xcode/simulators/index2.dvtdownloadableindex if that helps at all.

EricAtomic commented 1 year ago

Btw this issue seems to be causing CircleCI completely unable to test devices running iOS earlier than 15.5

mzsanford commented 1 year ago

@EricAtomic I made a fork with a hacked version to test this using the following commands:

    - run:
          name: Install iOS 14.5 Simulator
          command: >
            gem install specific_install &&
            gem specific_install -l https://github.com/mzsanford/xcode-install.git -b xcode14 &&
            xcversion simulators --install="iOS 14.5" &&
            xcrun simctl create 'iPhone 12 (14.5)' com.apple.CoreSimulator.SimDeviceType.iPhone-12 com.apple.CoreSimulator.SimRuntime.iOS-14-5

I ran into a different issue and ended up fixing my project so the test could run on iOS 15.5 as a workaround but maybe this will work for you. I did not make a PR because I'm unsure how that change will interact with different versions of Xcode.

EricAtomic commented 1 year ago

@mzsanford Thanks, that looks great!

marcosgriselli commented 1 year ago

@mzsanford what's your install_prefix?

mzsanford commented 1 year ago

@marcosgriselli I was unsure about that value, which is part of not making a real PR. I pulled that $(DEVELOPER) constant (note the single quotes, so not interpolated or executed or anything) from the output I found elsewhere from working versions. It might be totally wrong as I ended up just finding another workaround.

marcosgriselli commented 1 year ago

@rogerluan do you see any issues with updating the install prefix for this cases?