Reputation: 12314
Its unbelievable how bad the documentation is for React Native, they just put as little as possible for everything. I've already managed to run my app using option 1 but option 2 is even more unclear: https://facebook.github.io/react-native/docs/running-on-device-ios.html
I don't know there's no example of the terminal command react-native bundle in full so I know what is actually required there. For example --entry-file <path>
what path? The whole path from my hard drive root to this folder, or just the file itself? --bundle-output....? What the hell do I need to put for that? I don't know why they need to make it so damn unclear.
I'm surprised there's no other resources online that give the instructions more clearly. I guess that's why there aren't so many React Native apps on the app store.
Upvotes: 31
Views: 17489
Reputation: 350
This can be done from the terminal:
react-native run-ios --device "My iPhone" --configuration Release
Upvotes: 5
Reputation: 2589
the best way i could find,
just follow the step bellow
Release
sometimes metro bundle starts, may be its bug in IOS but you can close it
Please see the attached screenshot
Upvotes: 3
Reputation: 161
From React Native Docs:
Configure release scheme Building an app for distribution in the App Store requires using the Release scheme in Xcode. Apps built for Release will automatically disable the in-app Developer menu, which will prevent your users from inadvertently accessing the menu in production. It will also bundle the JavaScript locally, so you can put the app on a device and test whilst not connected to the computer.
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.
Upvotes: 10
Reputation: 2754
I hope you also find that this is a much easier approach. In the example below, my app was named BleMobileApp
. Feel free to change it to your app's name.
Duplicate the main deployment target and name it BleMobileApp-Deploy
.
Make sure to REMOVE the DEBUG=1
flag in BleMobileApp-Deply
's Build settings
(Do not touch the original target BleMobileApp
!)
New Run Script Phase
to BleMobileApp-Deploy
's Build phases and paste following command:yes | cp -rf ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/main.jsbundle $SRCROOT/main.jsbundle
That's it!
./node_modules/react-native/scripts/react-native-xcode.sh
like below (Line 43~47)
2. Change the default run script like below (For
BleMobileApp-Deploy
target):
export NODE_BINARY=node
FORCE_MINIFYING=true ../node_modules/react-native/scripts/react-native-xcode.sh
This should do the trick for you.
Happy coding!
Upvotes: 12