Reputation: 485
I'm using RN 0.39 that I upgraded a while ago from an older version.
I want to build my application on my CI environment using xcodebuild.
First I run the RN-cli to get the offline bundle:
react-native bundle --platform ios --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle
Then I'm simply run xcodebuild
in the nimblest way possible:
xcodebuild -scheme MyAppScheme -configuration Release
No matter what schemes, targets or configurations, this always opens the RN Packager which I need to avoid in my CI environment.
The latest AppDelegate.m versions are supposed to pickup the offline bundle if it's present, I wonder why mine is not doing.
Any thoughts?
Upvotes: 0
Views: 449
Reputation: 9978
I do not believe the latest AppDelegate.m files pick up the bundled file, as I was using 0.41 and it was loading the server all the time.
I have this, which will dynamically pick up the server or local file, depending if you are running debug or release builds. (Make sure you have a pre compiled flag of DEBUG=1 in your xCode):
#if DEBUG
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
#else
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
Upvotes: 2