Skip to content

Commit a2ef5b8

Browse files
radenofacebook-github-bot
authored andcommitted
Use main.jsbundle in iOS template for production build (#22531)
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
1 parent 8f6521a commit a2ef5b8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

local-cli/templates/HelloWorld/ios/HelloWorld/AppDelegate.m

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
1616
{
1717
NSURL *jsCodeLocation;
1818

19-
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
19+
#ifdef DEBUG
20+
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
21+
#else
22+
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
23+
#endif
2024

2125
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
2226
moduleName:@"HelloWorld"

0 commit comments

Comments
 (0)