Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 867
Sandro Machado Avatar asked Oct 28 '16 10:10

Sandro Machado


People also ask

How do you run release build in iOS React Native?

To configure your app to be built using the Release scheme, go to Product → Scheme → Edit Scheme. Select the Run tab in the sidebar, then set the Build Configuration dropdown to Release .

How do you run release build in Xcode React Native?

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.

Can we build iOS app using React Native?

React Native enables you to write Android and iOS apps using JavaScript. It uses React's virtual DOM concept to manipulate native platform UI components, providing a familiar experience to users. There are two ways to build iOS apps: React Native CLI: More complex but gives you more control over your app.


1 Answers

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" 
like image 116
Sandro Machado Avatar answered Sep 25 '22 15:09

Sandro Machado