Closed swrobel closed 8 months ago
Hey @swrobel, we'll change sorting device, so first it would try running on simulator not on physical device. But --list-devices
should work, and correctly pass simulator's UDID to the function. Can you please try using --interactive
, which is the same thing and choose simulator and say what's the result?
But
--list-devices
should work, and correctly pass simulator's UDID to the function. Can you please try using--interactive
, which is the same thing and choose simulator and say what's the result?
Just to be clear both --list-devices
and --interactive
launch the selected simulator, it's just that I thought it was supposed to be sticky, so the next time I run without any args, it should launch & use the last simulator that I selected. This doesn't seem to be the case after using these commands.
Okay, I gotcha. So actually the behavior that you described was added recently: https://github.com/react-native-community/cli/pull/2162. And in https://github.com/react-native-community/cli/pull/2251, we'll change what runs first - we'll prioritize simulators over devices in run-ios
command. If you have any other feedback, it's more than welcome! 🙏
@szymonrybczak I finally had the opportunity to test this now that React Native 0.74 is released with the new cli, but the behavior does not seem to be improved. In this case, I'm attempting to run my app with the "iPhone 15 Pro Max" simulator already booted. My personal iPhone 15 is connected via wifi, which is why you can see it referenced below:
$ yarn ios
yarn run v1.22.22
$ react-native run-ios
info A dev server is already running for this project on port 8081.
info Found Xcode workspace "Bakesy.xcworkspace"
info Found booted iPhone 15 Pro Max, Stefan’s iPhone 15
error Failed to install the app on the device because we couldn't execute the "ios-deploy" command. Please install it by running "brew install ios-deploy" and try again.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Ah, okay so we're launching app in opposite order to the way we log them - fixed in https://github.com/react-native-community/cli/pull/2364, log were not aligned with actual implementation.
Also I've shipped a small fix, so if you few simulators launched and you have your preferred one - it'll preferred one even if not inside --interactive
or --list-devices
mode.
My personal iPhone 15 is connected via wifi
In my personal experience launching on physical devices fails often than launching app on simulator, so we prioritize simulators over devices. Still in your scenario command will fail, but at least app will launch on simulators. I don't know we can improve expierence here 🤔
Fixes will ship in next patch for 0.74. Sorry for trouble and thanks for testing! :pray:
For those who still encounter this issue, this is the fix:
List all devices installed on your machine and select the UUID of the desired simulator
xcrun simctl list devices
Then start the simulator using the following line:
npm run ios -- --udid="AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA"
This is the official way to select a device: https://reactnative.dev/docs/running-on-simulator-ios#specifying-an-udid
What the docs don't say it that the UUID of the device will be stored for the next time you run just npm run ios
@3plusalpha Oh, yea we didn't sync docs with latest changes, do you mind submitting PR to react-native-website
repo? :pray:
@szymonrybczak I don't know which changes you mean. The commands above are actually mentioned in the repo
yea, but you've mentioned:
What the docs don't say it that the UUID of the device will be stored for the next time you run just npm run ios
and I assumed that documentation is not clear for you in this aspect.
Environment
Description
When running
yarn ios
, I expect it to run on the current open & running simulator, or to boot and run on an appropriate simulator. In the example shown below, I have the "iPhone SE (3rd generation)" already running, but the result is the same if it isn't running. It seems to try to useios-deploy
to install it onto my iPhone (connected to my computer via wifi only), rather than installing on the simulator.I have also tried previously running with
--list-devices
and choosing the iPhone SE so that it is "sticky," but that doesn't seem to have any impactBoth of these places state that
run-ios
should open on a Simulator:Reproducible Demo
I can put together a repro if necessary, but I believe this behavior is tied to the CLI, and not to anything specific to my app's code. As is the case with the default template generated, my
package.json
under the"scripts"
section defines theios
command as such"ios": "react-native run-ios"