I want to set a default simulator for my react native project so if I run the script
yarn ios
or npx react-native run-ios
it always start the "iPhone 12 Pro Max".
- using the
--simulator
flag once does not change the default simulator, and the next time I runyarn ios
orreact-native run-ios
it starts on different simulator - When I run
yarn ios
the app starts withiPhone 10
and when I runnpx react-native run-ios
the app starts withiPhone 8
. If I remove either of these simulators via xCode, the project does not start with mentioned scripts and throws an error that iPhone 10 or iPhone 8 was not found.
So my question is where in the project the value of these simulators are saved, and how to change it. Is it set somewhere in .xcworkspace
or .xcodeproj
? If someone clones this project and runs the app might start on different devices on their machine.
Note: I am not searching for answers including setting --simulator
flag
2
Answers
In your package.json file
Change this:
To this:
I hope this help you out.!
There is currently no official way besides
--simulator
to set device forrun-ios
as docYou can try to edit in ./node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js the default in end of file:
"react-native": "0.63.4"