在iOS设备上构建React Native应用程序

时间:2016-02-26 17:26:26

标签: ios react-native

我很好奇为什么我需要打开Xcode并点击" Build and Run" (按https://facebook.github.io/react-native/docs/running-on-device-ios.html#content),以便能够在我的iPhone上运行我的应用程序。

$ react-native help
Usage: react-native <command>

Commands:
  - start: starts the webserver
  - bundle: builds the javascript bundle for offline use
  - unbundle: builds javascript as "unbundle" for offline use
  - new-library: generates a native library bridge
  - link: Adds a third-party library to your project. Example: react-native   link awesome-camera
  - android: generates an Android project for your app
  - run-android: builds your app and starts it on a connected Android emulator or device
  - run-ios: builds your app and starts it on iOS simulator
  - upgrade: upgrade your app's template files to the latest version; run this after updating the react-native version in your package.json and running npm install

react-native命令的帮助页面仅向iOS模拟器显示run-ios,而run-android可以构建到设备或模拟器。

是否有人知道如何使用react-native-cli或其他命令行工具将我的应用程序直接构建到iPhone上的开发环境中,就像我按照上述文档一样?

1 个答案:

答案 0 :(得分:0)

我很确定这与供应配置文件相关联。您需要拥有配置文件才能在您的设备上运行您的应用程序,xCode会处理它们。

由于您不需要它们在模拟器上运行,您可以使用react-native-cli直接启动应用程序。但要在iPhone上运行它,您需要启动xCode以向Apple验证您的配置文件。

相关问题