2016-02-26 103 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

相關問題