Search code examples
xcodefastlanexcodebuild

How to add an iOS version to xcodebuild?


I downloaded Xcode 15 beta 3 and am trying to generate screenshots for 5.5" displays, but "iPhone 8 Plus" only goes up to iOS 16.4 (not iOS 17).

When I run "fastlane snapshot", I get the following error.

xcodebuild: error: Unable to find a destination matching the provided destination specifier:
                { platform:iOS Simulator, OS:16.4, name:iPhone 8 Plus }

        Available destinations for the "TestUITests" scheme:
                { platform:macOS, arch:x86_64, variant:Mac Catalyst, id:2930A22F-BA93-5B71-907D-5B1A1A1A16DD }
                { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
                { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
                { platform:macOS, variant:Mac Catalyst, name:Any Mac }
                { platform:iOS Simulator, id:585C0B73-FFA4-484E-B6A0-39FAC08ECA13, OS:17.0, name:iPad (10th generation) }
                { platform:iOS Simulator, id:344436B2-9F5E-4958-B3A4-B90170C5109F, OS:17.0, name:iPad Air (5th generation) }
                { platform:iOS Simulator, id:B16056A7-3611-4F2A-9EB0-1B90DAABBF73, OS:17.0, name:iPad Pro (11-inch) (4th generation) }
                { platform:iOS Simulator, id:C2CB12F0-D8B0-4400-A2CC-5CE0EA3DB7C4, OS:17.0, name:iPad Pro (12.9-inch) (6th generation) }
                { platform:iOS Simulator, id:E0144E23-609B-4746-8A26-3E653C098E2C, OS:17.0, name:iPad mini (6th generation) }
                { platform:iOS Simulator, id:A6E64A59-BC7E-439D-86BD-6D8EAA5003AF, OS:17.0, name:iPhone 14 }
                { platform:iOS Simulator, id:C531B018-84C1-4DB9-87B0-BEAB7CA9FE2A, OS:17.0, name:iPhone 14 Plus }
                { platform:iOS Simulator, id:41E7EB4F-A827-4E10-A958-38E9AC790A01, OS:17.0, name:iPhone 14 Pro }
                { platform:iOS Simulator, id:4B2204AD-2B52-4E8B-9772-FB2633F3A847, OS:17.0, name:iPhone 14 Pro Max }
                { platform:iOS Simulator, id:0D173B9F-CCFB-4B24-A0BB-6C315414D3F4, OS:17.0, name:iPhone SE (3rd generation) }
[15:45:58]: Exit status: 70

Why doesn't xcodebuild include versions other than iOS 17 while Xcode has multiple platforms?

platforms iOS 16.4 and 17

Repo to replicate.

How can I add iOS 16.4 to xcodebuild? I tried xcodebuild -downloadPlatform iOS because of

To download and install all the platforms that the Xcode version you selected supports, use the -downloadAllPlatforms option on xcodebuild. - documentation

but I get All requested platforms are downloaded.


Solution

  • You can also go to the Apple Developer site, and download the iOS simulators directly from here https://developer.apple.com/download/all/?q=Simulator%20Runtime

    Then add this using these commands

    xcodebuild -runFirstLaunch

    xcrun simctl runtime add "~/Downloads/watchOS 9 beta Simulator Runtime.dmg"

    Reference:

    https://developer.apple.com/documentation/xcode/installing-additional-simulator-runtimes#Install-and-manage-Simulator-runtimes-from-the-command-line