简体   繁体   English

更改默认运行模拟器 - react-native?

[英]Change default running simulator - react-native?

I want to change default simulator when building my app,我想在构建我的应用程序时更改默认模拟器,

I'm trying to run this command react-native run-ios --simulator='iPhone XR'我正在尝试运行此命令react-native run-ios --simulator='iPhone XR'

but it's ignoring me :D and just launch iPhone XI don't know why?但它无视我 :D 并且只推出 iPhone XI 不知道为什么?

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当我打开Xcode和选择什么样的模拟器的话,我想按运行图标,它的工作很好,但我并不需要打开的Xcode我想建立我的应用程序,它的HART我的电脑LO每次

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:此外,您可以使用命令从列表中启动模拟器,而无需打开 xcode,例如:

 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. 4050BA57-C65E-4EDD-9CB3-38AAA9379912是模拟器的 UUID,您将从列表中获取它。

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使用 React Native 更改默认模拟器,您可以尝试从node-modules/react-native/local-cli/runIOS.js文件中更改--simulator选项的值

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.您可以将iPhone Xʀ更改为您需要的模拟器。

As you are making these changes inside the node-modules it might get changed or affected after npm or yarn install .当您在node-modules内进行这些更改时,它可能会在npm or yarn install之后发生更改或影响。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM