From 0eb8eab264d083ed99ab2ab3493ce2b54acb2ad0 Mon Sep 17 00:00:00 2001 From: Jonathan Carter Date: Mon, 2 Nov 2015 13:25:47 -0800 Subject: [PATCH] Simplify loadBundle --- CodePush.m | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/CodePush.m b/CodePush.m index feff6aa..afad6bb 100644 --- a/CodePush.m +++ b/CodePush.m @@ -52,16 +52,10 @@ NSString * const UpdateBundleFileName = @"app.jsbundle"; - (void)loadBundle { - dispatch_async(dispatch_get_main_queue(), ^{ - RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:[CodePush getBundleUrl] - moduleName:[CodePushConfig getRootComponent] - initialProperties:nil - launchOptions:nil]; - - UIViewController *rootViewController = [[UIViewController alloc] init]; - rootViewController.view = rootView; - [UIApplication sharedApplication].delegate.window.rootViewController = rootViewController; - }); + // Reset the runtime's bundle to be + // the latest URL, and then force a refresh + _bridge.bundleURL = [CodePush getBundleUrl]; + [_bridge reload]; } - (void)rollbackPackage