From a2ef5b85d8c46cefd5873bf5fc6dddabf1d51d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radovan=20=C5=A0mitala?= Date: Thu, 6 Dec 2018 19:27:33 -0800 Subject: [PATCH] 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: https://github.com/facebook/react-native/pull/22531 Differential Revision: D13372773 Pulled By: cpojer fbshipit-source-id: 888c675b7d11b1a323445e092ec9ff83924c42f4 --- local-cli/templates/HelloWorld/ios/HelloWorld/AppDelegate.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/local-cli/templates/HelloWorld/ios/HelloWorld/AppDelegate.m b/local-cli/templates/HelloWorld/ios/HelloWorld/AppDelegate.m index d4d87a689fb567..0a959f804385b1 100644 --- a/local-cli/templates/HelloWorld/ios/HelloWorld/AppDelegate.m +++ b/local-cli/templates/HelloWorld/ios/HelloWorld/AppDelegate.m @@ -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"