直接从命令行在iOS设备上运行react-native应用程序? [英] Run react-native application on iOS device directly from command line?
问题描述
是否可以直接从命令行在iOS设备上运行react-native应用程序,就像我们在模拟器上运行 react-native run ios --simulatoriPhone 5s
?
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 5s"
?
推荐答案
以下对我有效(在本机上测试 0.38
和 0.40
):
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"
这个是根据fb这样做的正确方法。如果您尝试仅运行run-ios命令,您会发现脚本建议您在构建后的安装步骤中安装-g ios-deploy。
This is the proper way to do this according to fb. If you try to run just the run-ios command, you will find that the script recommends that you npm install -g ios-deploy when it comes to the install step after building.
虽然有关反应本机提供的各种命令的文档有点粗略,但值得做正如他们所建议的那样并进入查看react-native / local-cli。在那里,您可以看到所有可用的命令以及它们运行的代码 - 您可以找出哪些开关可用于未记录的命令。
While the documentation on the various commands that react-native offers is a little sketchy, it is worth doing as they suggest and going in to look at 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.
这篇关于直接从命令行在iOS设备上运行react-native应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!