Search code examples
iosxcodereact-nativeios-simulatorxcodebuild

How to change destination id for react-native xcodebuild


I new to mac and I'm trying to clone my current WIP react native project (which target for iOS build only) and setup on my new Mac machine. However I constantly hitting following error, I searched everywhere in Xcode xcworkspace, tried quite a number of settings changes (deployment target etc.) and have no idea how to change destination id. Please help. Thanks.

elliotkaliv@Elliots-Mac-mini projNameeeeeeee % yarn ios
yarn run v1.22.10
$ npx react-native run-ios --simulator='iPad Air'
warn Package filenamify has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /Users/elliotkaliv/Documents/prjs/projNameeeeeeee/node_modules/filenamify/package.json
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually: 
  - react-native-vector-icons (to unlink run: "react-native unlink react-native-vector-icons")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
info Found Xcode workspace "projNameeeeeeee.xcworkspace"
info Building (using "xcodebuild -workspace projNameeeeeeee.xcworkspace -configuration Debug -scheme projNameeeeeeee -destination id=DDAF30B3-2CC8-460E-B05A-0E672CE9C59C")
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 70. To debug build logs further, consider building your app with Xcode.app, by opening projNameeeeeeee.xcworkspace.
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace projNameeeeeeee.xcworkspace -configuration Debug -scheme projNameeeeeeee -destination id=DDAF30B3-2CC8-460E-B05A-0E672CE9C59C

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES


xcodebuild: error: Unable to find a destination matching the provided destination specifier:
                { id:DDAF30B3-2CC8-460E-B05A-0E672CE9C59C }

        Available destinations for the "projNameeeeeeee" scheme:
                { platform:macOS, arch:arm64, variant:Designed for [iPad,iPhone], id:EFF665D5-5FBC-514A-BBD3-F593B237E458 }
                { platform:iOS Simulator, id:96C0A232-B926-4C02-9DF6-89066487EF8D, OS:14.4, name:iPad (8th generation) }
                { platform:iOS Simulator, id:1F102212-0663-4AC1-8AF3-A6A46059B35C, OS:14.5, name:iPad (8th generation) }
                { platform:iOS Simulator, id:A193D152-0330-4FE5-BF13-874BA3538AC2, OS:14.1, name:iPad Air (4th generation) }
                { platform:iOS Simulator, id:F67B9A1B-E43A-47D7-9996-303E37CE9E91, OS:14.5, name:iPad Air (4th generation) }
                { platform:iOS Simulator, id:2DDEB0DB-D658-4343-9BBC-A2AE9BDFCBF4, OS:14.1, name:iPad Pro (9.7-inch) }
                { platform:iOS Simulator, id:FB9B5898-9892-420B-BB70-67E19CF1BEEE, OS:14.4, name:iPad Pro (9.7-inch) }
                { platform:iOS Simulator, id:EB82A729-BD5E-4F70-9F00-AE590AF743D0, OS:14.5, name:iPad Pro (9.7-inch) }
                { platform:iOS Simulator, id:C58EB805-AFD9-4FA1-8FA5-EAA4034AA915, OS:14.1, name:iPad Pro (11-inch) (2nd generation) }
                { platform:iOS Simulator, id:E3496671-D43A-4E1A-B33D-476F2022FFB4, OS:14.4, name:iPad Pro (11-inch) (2nd generation) }
                { platform:iOS Simulator, id:0965280C-C978-4721-B720-D51AF187CCA9, OS:14.5, name:iPad Pro (11-inch) (3rd generation) }
                { platform:iOS Simulator, id:29A34DD5-637E-41A8-9F11-B3EA9660083B, OS:14.1, name:iPad Pro (12.9-inch) (4th generation) }
                { platform:iOS Simulator, id:8D1E91AE-D046-43C6-8E56-DC16B01DDCC6, OS:14.4, name:iPad Pro (12.9-inch) (4th generation) }
                { platform:iOS Simulator, id:1C028811-E780-40D1-BDE0-73105A705367, OS:14.5, name:iPad Pro (12.9-inch) (5th generation) }

        Ineligible destinations for the "projNameeeeeeee" 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 }

info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Solution

  • To asnwer my own question, I don't think it is possible to change destination id but simulator name. In my case, I found the correct command is to exactly match my simulator name which is example

    npx react-native run-ios --simulator='iPad Air (4th generation)'
    

    to rename a specific simulator name, go to XCODE (example screenshot given is v13.0):

    on toolbar: Window > Devices and Simulators

    and rename a simulator to a unique name

    enter image description here