xcodebuild for generic/platform=iOS Simulator is failing on my MacBook

I am having a framework that I am building using a buildscript using xcodebuild. The framework archives for all architectures required so that it can be used in another Xcode project.

However, since I have installed Xcode 14, the build script gives an error when I am building for iOS Simulator. I do need to build the framework for iOS simulator as well so that developers can test their app that use the framwework on an iOS simulator.

The command line to archive the framework for iOS Simulator is:

xcodebuild archive -scheme <TargetName> -destination 'generic/platform=iOS Simulator'     -archivePath <ArchivePath> SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES

The error I am getting is:

xcodebuild: error: Unable to find a destination matching the provided destination specifier:
	{ generic:1, platform:iOS Simulator }

This works well for all other destinations I am building the framework for (watchOS, iOS, watchOS Simulator), just not for iOS Simulator

In the output of xcodebuild is shows the available platforms. Among all the specific Simulators that are available, it also has a 'generic' entry for the 'watchOS Simulator' destination:

{ platform:watchOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-watchsimulator:placeholder, name:Any watchOS Simulator Device  

An equivalent entry is not available in the list for 'iOS Simulator' as you can see in the output of xcodebuild below. Is this the problem I am facing and should there be a similar 'Any iOS Simulator Device' entry in this list?

And if this is the problem, how can I add a generic 'iOS Simulator'? If not, what could be the problem instead?

For complete information, this is the full output of the xcodebuild command:

Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild archive -scheme <SCHEME> -destination "generic/platform=iOS Simulator" -archivePath Archiver/<archive-name>.xcarchive SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES

User defaults from command line:
IDEArchivePathOverride = /<directory>/<archive-name>.xcarchive
IDEPackageSupportUseBuiltinSCM = YES

Build settings from command line:
BUILD_LIBRARIES_FOR_DISTRIBUTION = YES
SKIP_INSTALL = NO

2022-10-03 16:18:52.358 xcodebuild[17449:3179785] Writing error result bundle to /var/folders/lj/n7mj7ccd3dd4fds0x_0jh0w00000gn/T/ResultBundle_2022-03-10_16-18-0052.xcresult
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
	{ generic:1, platform:iOS Simulator }

Available destinations for the <scheme-name> scheme:
	{ platform:macOS, arch:x86_64, variant:Mac Catalyst, id:41E4E96D-C631-58DB-8E17-3556BF095CE6 }
	{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
	{ platform:macOS, variant:Mac Catalyst, name:Any Mac }
	{ platform:watchOS, id:dvtdevice-DVTiOSDevicePlaceholder-watchos:placeholder, name:Any watchOS Device }
	{ platform:watchOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-watchsimulator:placeholder, name:Any watchOS Simulator Device }
	{ platform:watchOS Simulator, id:85EAEDB9-281C-4C42-BB07-D381344B4F01, OS:9.0, name:Apple Watch SE (44mm) (2nd generation) }

.... And more specific Simulator devices as configured in Xcode ....

	{ platform:iOS Simulator, id:CC7BF3A6-62CB-4AC3-9E13-ED20DA1CC9E0, OS:16.0, name:iPhone SE (3rd generation) }
  • did you found anything helpful in this Thanks in advance.

  • So far I haven't other than installing Xcode 13 again.. Have you found anything yet?

Add a Comment

Replies

What happens if you replace the single quote with double quotes around the destination argument?

  • I tried that, but no luck unfortunately :(

    It seems to happen with Xcode 14, when I install Xcode 13 and run Xcode 13's xcbuild it works correctly. It would be great to have Any iOS simulator device back in the list of available devices so we can build our packages for generic iOS simulators again..

Add a Comment

I am also facing this issue has anyone found any luck on this. I am making build using script and using single quotes only. Please find the script

    # archieve the build
    ARCHIEVE_PATH="$BUILD_DIR&#x2F;${ASSET_BASENAME}&#x2F;$EXPORT_METHOD&#x2F;${PRODUCT_NAME}.xcarchive"
    (xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -configuration "$CONFIGURATION" -destination &#039;generic&#x2F;platform=iOS&#039; -archivePath "$ARCHIEVE_PATH" clean archive 1> &#x2F;dev&#x2F;null ||
    xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -configuration "$CONFIGURATION" -destination &#039;generic&#x2F;platform=iOS&#039; -archivePath "$ARCHIEVE_PATH" clean archive ||
    failed "XCode failed to build app")

and I am getting following on the Jenkins console

    &#x2F;Applications&#x2F;Xcode.app&#x2F;Contents&#x2F;Developer&#x2F;usr&#x2F;bin&#x2F;xcodebuild -workspace BroughSuperior.xcworkspace -scheme BroughSuperior -configuration Release -destination generic&#x2F;platform=iOS -archivePath "administrator&#x2F;testing-app5_ios_2023-05-05-10:10:33&#x2F;enterprise&#x2F;testing-app5.xcarchive" clean archive

User defaults from command line:
    IDEArchivePathOverride = &#x2F;Users&#x2F;administrator&#x2F;.jenkins&#x2F;jobs&#x2F;iOS Bruff dev&#x2F;workspace&#x2F;BroughSuperior&#x2F;administrator&#x2F;testing-app5_ios_2023-05-05-10:10:33&#x2F;enterprise&#x2F;testing-app5.xcarchive
    IDEPackageSupportUseBuiltinSCM = YES

Please help I can not use Xcode 13 now, since apple has stopped taking builds from Xcode 13. And the same command works in Xcode 13