Oxcug
Oxcug

Reputation: 6604

Building a Release build for iOS Simulator?

I'm trying to use the xcodebuild CLI to build my app with the "release configuration" (-c Release) and with the destination of the iOS Simulator (-destination "platform: iOS Simulator"). However, xcodebuild doesn't seem to support this behavior as it responds with:

$ xcodebuild -workspace Y.xcworkspace -scheme X -configuration Release -destination 'platform=iOS Simulator'
                           
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
        { platform:iOS Simulator }

    Missing required device specifier option.
    The device type “iOS Simulator” requires that either “name” or “id” be specified.
    Please supply either “name” or “id”.

    Available destinations for the "X" scheme:
        { platform:iOS Simulator, id:E01124DF-3E66-490B-BD28-351FF6CD3D1A, OS:14.1, name:iPad (8th generation) }
        { platform:iOS Simulator, id:40233395-556F-4A5B-A499-A238C4FA159A, OS:14.1, name:iPad Air (4th generation) }
        { platform:iOS Simulator, id:FE1018BD-4128-4E1F-9FE8-FEA4054DD8A8, OS:14.1, name:iPad Pro (9.7-inch) }
        { platform:iOS Simulator, id:88F79AD4-1F96-48B8-897B-D74DB4D6BBC2, OS:14.1, name:iPad Pro (11-inch) (2nd generation) }
        { platform:iOS Simulator, id:54BA4991-5C8D-41E4-9615-AEFDFAF167ED, OS:14.1, name:iPad Pro (12.9-inch) (4th generation) }
        { platform:iOS Simulator, id:2BEF87F9-5F1A-4339-B2C4-B9E634D03DB4, OS:14.1, name:iPhone 8 }
        { platform:iOS Simulator, id:E9CFA859-26B4-4009-A2FB-80161792FA30, OS:14.1, name:iPhone 8 Plus }
        { platform:iOS Simulator, id:DA1BE525-88B4-46F9-BE22-2EE2F46B669E, OS:14.1, name:iPhone 11 }
        { platform:iOS Simulator, id:5C658068-B26A-4265-9D49-D84084BFBB4F, OS:14.1, name:iPhone 11 Pro }
        { platform:iOS Simulator, id:455801A6-11F7-473B-97EB-FFE991C0CF48, OS:14.1, name:iPhone 11 Pro Max }
        { platform:iOS Simulator, id:7FC46741-BE28-4FA1-9921-6D341EAC5A36, OS:14.1, name:iPhone 12 }
        { platform:iOS Simulator, id:F5321E54-6500-4349-9175-C9715F3E230B, OS:14.1, name:iPhone 12 Pro }
        { platform:iOS Simulator, id:B3F46645-5380-4566-9070-DA25817B88D2, OS:14.1, name:iPhone 12 Pro Max }
        { platform:iOS Simulator, id:EBA39463-9D2E-40AB-B2E7-E802D8AE8680, OS:14.1, name:iPhone 12 mini }
        { platform:iOS Simulator, id:16F15877-230B-46FC-A36C-C984DFE12E66, OS:14.1, name:iPhone SE (2nd generation) }
        { platform:iOS Simulator, id:1588FB27-6FD2-4970-9D55-FF430006C766, OS:14.1, name:iPod touch (7th generation) }

    Ineligible destinations for the "X" scheme:
        { 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 }

TLDR:

  1. Why is it listing the Any iOS Simulator Device option as ineligible?

  2. Is there any way to create a release flavor build for simulator?

Note: I also tried using the -sdk iphonesimulator option instead of -destination ..., but my iOS app includes a WatchKit App which confuses xcode when it tries to build that dependency.

Upvotes: 1

Views: 3941

Answers (1)

Oxcug
Oxcug

Reputation: 6604

Ah, figured it out. I was just missing the "generic" specifier. So it should be:

-destination "generic/platform=iOS Simulator"

Upvotes: 6

Related Questions