From c488fecbc2e0b6e9a69d77e4226909422511fb37 Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Fri, 15 Jan 2016 02:01:45 -0800 Subject: [PATCH] Update ReactExample to use right JS build For the simulator it will use the packager, but on device it will use the bundled JS build. --- .../ios/ReactExample/AppDelegate.m | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/examples/ReactExample/ios/ReactExample/AppDelegate.m b/examples/ReactExample/ios/ReactExample/AppDelegate.m index adaf8f33..49d8054a 100644 --- a/examples/ReactExample/ios/ReactExample/AppDelegate.m +++ b/examples/ReactExample/ios/ReactExample/AppDelegate.m @@ -12,9 +12,8 @@ { NSURL *jsCodeLocation; +#if TARGET_OS_SIMULATOR /** - * Loading JavaScript code - uncomment the one you want. - * * OPTION 1 * Load from development server. Start the server from the repository root: * @@ -26,19 +25,21 @@ * on the same Wi-Fi network. */ - jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios"]; +#if DEBUG + jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; +#else + jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=false"]; +#endif +#else /** * OPTION 2 - * Load from pre-bundled file on disk. To re-generate the static bundle - * from the root of your project directory, run - * - * $ react-native bundle --minify - * - * see http://facebook.github.io/react-native/docs/runningondevice.html + * Load from pre-bundled file on disk. The static bundle is automatically + * generated by "Bundle React Native code and images" build step. */ - // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; + jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; +#endif RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"ReactExample"