在终端测试时如何更改默认的 Xcode iphone 模拟器?

How to change the default Xcode iphone simulator when testing in the terminal?

我知道这里有一个类似的问题: (How to change the default Xcode iphone simulator when testing) 但它仍然没有回答如何在终端中进行操作的问题。

意思是:我现在正在做一个 React Native 项目,当我 运行 在终端(react-native 运行-ios)它打开 iPhone 6. 现在我想将此默认值更改为 iPhone 7,因为它在我的屏幕上效果更好。我该如何改变这个。 (我试过在 Xcode 中更改它,但它一直在改回去。)

我查看了所有类似的问题,但没有找到直接的答案。有人知道吗?

您可以在命令中提供您喜欢的模拟器:

react-native run-ios --simulator="iPhone5"

您可以从终端通过运行此命令检查可用的模拟器:

xcrun simctl list devices

你在终端运行时设置 Package.json 你点击这些像 yarn ios-max

"scripts": {
    "reinstall": "rm -rf node_modules; yarn cache clean; yarn install",
    "ios": "react-native run-ios",
    "ios-min": "react-native run-ios --simulator 'iPhone 5s'",
    "ios-mid": "react-native run-ios --simulator 'iPhone 8 Plus'",
    "ios-max": "react-native run-ios --simulator 'iPhone X'",
    "ipad": "react-native run-ios --simulator 'iPad Air'",
    "ios-device": "react-native run-ios --device",
    "android-min": "react-native run-android",
    "android-max": "react-native run-android",
    "android-release": "react-native run-android --variant=release",
}

Simulator -> Hardware -> Device iOS 11.1 -> click one as default