Skip to content

Commit

Permalink
Use main.jsbundle in iOS template for production build (#22531)
Browse files Browse the repository at this point in the history
Summary:
Default HelloWorld template for iOS doesn't make production main.jsbundle. This is little bit confusing in compare with Android building app when everything works one first run.

Make it seamless, reduce confuse.
Based on docs https://facebook.github.io/react-native/docs/running-on-device#3-configure-app-to-use-static-bundle

Fixes #22335
Fixes #18562
Pull Request resolved: #22531

Differential Revision: D13372773

Pulled By: cpojer

fbshipit-source-id: 888c675b7d11b1a323445e092ec9ff83924c42f4
  • Loading branch information
radeno authored and facebook-github-bot committed Dec 7, 2018
1 parent 8f6521a commit a2ef5b8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion local-cli/templates/HelloWorld/ios/HelloWorld/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
{
NSURL *jsCodeLocation;

jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#ifdef DEBUG
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif

RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"HelloWorld"
Expand Down

0 comments on commit a2ef5b8

Please # to comment.