-1

I want to change default simulator when building my app,

I'm trying to run this command react-native run-ios --simulator='iPhone XR'

but it's ignoring me :D and just launch iPhone X I don't know why?

when I open Xcode and choose what simulator i want then press Run icon it's work fine, but i don't need open Xcode every time i want to build my app, it's hart my Pc lo

Oliver D
  • 2,579
  • 6
  • 37
  • 80

1 Answers1

0

The Simulator you are trying in command might not be available in your simulators list. You can check the list of simulators list with the command:

 xcrun simctl list

Also, you can start the simulator from the list with command without opening the xcode like:

 xcrun simctl boot 4050BA57-C65E-4EDD-9CB3-38AAA9379912

4050BA57-C65E-4EDD-9CB3-38AAA9379912 is the UUID of the simulator you will get it from list.

With React Native to change the default simulator you can try to change the value of --simulator option from node-modules/react-native/local-cli/runIOS.js file

It will be by default like this:

{
    command: '--simulator [string]',
    description: 'Explicitly set simulator to use',
    default: 'iPhone Xʀ',
  } 

You can change that iPhone Xʀ to your required simulator.

As you are making these changes inside the node-modules it might get changed or affected after npm or yarn install.

Bhagwat K
  • 2,982
  • 2
  • 23
  • 33