Description
Environment
System:
OS: macOS 15.5
CPU: (8) arm64 Apple M2
Memory: 161.50 MB / 8.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.12.0
path: ~/.nvm/versions/node/v22.12.0/bin/node
Yarn: Not Found
npm:
version: 10.9.0
path: ~/.nvm/versions/node/v22.12.0/bin/npm
Watchman:
version: 2025.04.28.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.2
- iOS 18.2
- macOS 15.2
- tvOS 18.2
- visionOS 2.2
- watchOS 11.2
Android SDK:
API Levels:
- "35"
Build Tools:
- 35.0.0
System Images:
- android-35 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2024.3 AI-243.25659.59.2432.13423653
Xcode:
version: 16.2/16C5032a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.12
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 18.0.0
wanted: 18.0.0
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.79.3
wanted: 0.79.3
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Description
I am running the command npx react-native run-ios
with either the --list-devices
, --udid
or --device
flags. The build process works as expected and you can see that the project is being built upon the selected device. However, the installation and deployment fails because another device is chosen.
The wrong target device seems to be selected because of the following xcodebuild warning:
- WARNING: Using the first of multiple matching destinations
But why is my target device being ignored?
What is the point of specifing a target then?
This issue seems to have been introduced between versions 15 and 18 of @react-native-community/cli 18.0.0. Older versions do not seem to have this problem. I posted some screenshots about this at the bottom.
Reproducible Demo
Due to the warning mentioned by Xcode when running the command npx react-native run-ios
:
- WARNING: Using the first of multiple matching destinations
I can trigger this deployment bug in any repository using @react-native-community/cli >= 17 (19.0.0 version also fails). For example, with this simple repository:
I only have to try to deploy the project to an iOS device with the command npx react-native run-ios
and specify the target device. Even though, I cannot deploy the project from with the above command. I can actually deploy the project if I do it from Xcode. Therefore, it should not be an issue with the iPhone device or similar.
Temporary fix
Downgrade to @react-native-community/cli < 17
Screenshots
List of devices detected by Xcode
A few screenshots displaying that this issue happens in any repository.
https://github.com/oserrabassa-jcm/crispy-happiness
https://github.com/react-native-community/reproducer-react-native
https://github.com/react-native-community/template/tree/0.79-stable
This is the original project where I first discovered and experienced the issue.
https://github.com/react-native-community/template/tree/0.78-stable
https://github.com/react-native-community/template/tree/0.75-stable