【问题标题】:How to change the default Xcode iphone simulator when testing in the terminal?在终端测试时如何更改默认的 Xcode iphone 模拟器?
【发布时间】:2018-04-15 02:02:41
【问题描述】:

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

含义:我现在正在开发一个 React Native 项目,当我在终端(react-native run-ios)中运行它时,它会打开 iPhone 6。现在我想将此默认设置更改为 iPhone 7在我的屏幕上效果更好。我该如何改变这一点。 (我尝试在 Xcode 中更改它,但它一直在变回来。)

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

【问题讨论】:

    标签: xcode react-native terminal ios-simulator


    【解决方案1】:

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

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

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

    xcrun simctl list devices

    【讨论】:

      【解决方案2】:

      你在终端运行时中的 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",
      }
      

      【讨论】:

        【解决方案3】:

        模拟器 -> 硬件 -> 设备 iOS 11.1 -> 默认点击一个

        【讨论】:

          猜你喜欢
          • 2011-04-08
          • 2016-01-30
          • 2023-03-09
          • 2017-04-20
          • 1970-01-01
          • 2017-11-10
          • 2021-09-03
          • 2021-11-01
          • 2011-05-18
          相关资源
          最近更新 更多