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

最后都变了- 提交于 2020-01-04 03:59:07

问题


I know there is a simular question here: (How to change the default Xcode iphone simulator when testing) But it still doesn't answer the question of how to do it in the terminal.

Meaning: I'm working on a React Native project now & when I run it in the terminal (react-native run-ios) it opens iPhone 6. Now I would like to change this default to a iPhone 7 as it works better on my screen. How can I change this. (I've tried changing it in Xcode, but It keeps changing back.)

I have looked through All similar questions, and haven't found a straight forward answer. Does anyone know?


回答1:


You can provide your preferred simulator in the command as:

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

You can check the available simulators by running this command from the terminal:

xcrun simctl list devices




回答2:


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




回答3:


you set in Package.json in the terminal runtime you Hit these like 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",
}


来源:https://stackoverflow.com/questions/47077128/how-to-change-the-default-xcode-iphone-simulator-when-testing-in-the-terminal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!