iosreact-nativereact-native-cli

Run a React Native iOS release build from terminal


I am trying to run the release build directly from the terminal and I did not found an option to do that.

From XCode what is required to do is:

Product -> Scheme -> Edit Scheme (cmd + <), make sure you're in the Run tab from the side, and set the Build Configuration dropdown to release.

http://facebook.github.io/react-native/docs/running-on-device-ios.html#building-your-app-for-production

There is any option available from the react-native-cli to do the same? Something like react-native run-ios -configuration Release?

My objective is to generate a build that does not require the server being running to provide to the QA team for instance.


Solution

  • I did a PR to the React Native project to allow this feature. The PR can be check here: https://github.com/facebook/react-native/commit/ca7cbdee858e84c4a74a2d9c7be151f5cfdcfbfe

    So, in the future, to run a release build from terminal you just only need to type the following command: npx react-native run-ios --configuration Release

    If you want run your project on a real device use --device parameter:

    npx react-native run-ios --configuration Release --device "Your Device Name"