Run react-native application on iOS device directly from command line?

前端 未结 7 1472
春和景丽
春和景丽 2020-12-12 10:41

Is it possible to run react-native application on an iOS device directly from the command line like we do on simulator with react-native run ios --simulator \"iPhone 5

7条回答
  •  無奈伤痛
    2020-12-12 11:18

    The following worked for me (tested on react native 0.38 and 0.40):

    npm install -g ios-deploy
    # Run on a connected device, e.g. Max's iPhone:
    react-native run-ios --device "Max's iPhone"
    

    If you try to run run-ios, you will see that the script recommends to do npm install -g ios-deploy when it reach install step after building.

    While the documentation on the various commands that react-native offers is a little sketchy, it is worth going to react-native/local-cli. There, you can see all the commands available and the code that they run - you can thus work out what switches are available for undocumented commands.

提交回复
热议问题