Right now I can successfully run my react-native app on the device (iPhone/iOS). However, I have to be connected to my WI-FI for that to work (no need to be plugged in with USB). When I disconnect from my WI-FI the app no longer works on the phone. It doesn't load properly/crashes. Is there a way to run my react-native app on the device outside of my home network/wi-fi?
If you are running react-native 0.29.0 or above you can simply change the scheme to "release" and it should build an offline bundle of your app - so you can use it without being on your wifi.
If you are using react-native 0.28.0 or below then you still need to change the scheme to "release", but you also need to change some code in your AppDelegate.m
file:
Comment out this line:
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
And then uncomment this line:
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
This puts your app into "Production" mode so you will not be able to access the debug menu.
Hope this helps! :)
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