直接从命令行在 iOS 设备上运行 react-native 应用程序? [英] Run react-native application on iOS device directly from command line?
问题描述
是否可以像我们在模拟器上使用 react-native run ios --simulator "iPhone 5s"
那样直接从命令行在 iOS 设备上运行 react-native 应用程序?
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"
?
推荐答案
以下对我有用(在 react native 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"
如果您尝试运行 run-ios
,您会看到脚本在构建后到达安装步骤时建议执行 npm install -g ios-deploy
.
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.
虽然关于 react-native 提供的各种命令的文档有点粗略,但值得去 react-native/local-cli.在那里,您可以看到所有可用的命令以及它们运行的代码——因此您可以确定哪些开关可用于未记录的命令.
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.
这篇关于直接从命令行在 iOS 设备上运行 react-native 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!