Run a React Native iOS release build from terminal Run a React Native iOS release build from terminal ios ios

Run a React Native iOS release build from terminal


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"


As far as I know, react native doesn't come with something like that out-of-the-box.

But because your react-native app is also a plain Objective-C app with react-native on the inside, you can re-use existing tools to perform the build/packaging for you.

Check the following article for example on how to automate your build using fastlane.

https://shift.infinite.red/simple-react-native-ios-releases-4c28bb53a97b#.i1otlntat


The react-native script that handles the bundling is here:

  ./node_modules/react-native/scripts/react-native-xcode.sh

and it basically does this:

  node "./node_modules/react-native/cli.js" bundle  --entry-file "index.js" --platform ios --dev false --reset-cache --bundle-output "./app.app/main.jsbundle" --assets-dest "./app.app"

where bundle-output and asset-dest would normally point to your xcode build output. For example:

~/Library/Developer/Xcode/DerivedData/MyApp-enjmlvtpwwpnsxanntxwgpneywcy/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Release-iphonesimulator/MyApp.app