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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With