2016-02-26 86 views
0

我很好奇为什么需要打开Xcode并单击“构建并运行”(每https://facebook.github.io/react-native/docs/running-on-device-ios.html#content)以便能够在我的iPhone上运行我的应用程序。在iOS设备上构建React Native应用程序

$ 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命令显示run-ios只是到iOS模拟器的帮助页面,而run-android可以建立到设备或仿真器。

有谁知道我可以如何使用react-native-cli或其他命令行工具,以便能够将我的应用程序直接构建到我的iPhone上的开发环境,就像我遵循上述文档一样?

回答

0

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

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

+0

这很有道理 – Jesse

相关问题