From b08e98797174fbdff2ca7f72f376e869983cfa8a Mon Sep 17 00:00:00 2001 From: Richard Hua Date: Tue, 4 Oct 2016 06:09:50 -0700 Subject: [PATCH] Fix issue where restarts did not happen on IMMEDIATE installs --- ios/CodePush/CodePush.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ios/CodePush/CodePush.m b/ios/CodePush/CodePush.m index 3885fff..79f2351 100644 --- a/ios/CodePush/CodePush.m +++ b/ios/CodePush/CodePush.m @@ -64,6 +64,7 @@ static NSString *bundleResourceSubdirectory = nil; + (void)initialize { + [super initialize]; if (self == [CodePush class]) { // Use the mainBundle by default. bundleResourceBundle = [NSBundle mainBundle]; @@ -231,7 +232,6 @@ static NSString *bundleResourceSubdirectory = nil; #pragma mark - Private API methods -@synthesize bridge = _bridge; @synthesize methodQueue = _methodQueue; @synthesize pauseCallback = _pauseCallback; @synthesize paused = _paused; @@ -255,7 +255,7 @@ static NSString *bundleResourceSubdirectory = nil; - (void)clearDebugUpdates { dispatch_async(dispatch_get_main_queue(), ^{ - if ([_bridge.bundleURL.scheme hasPrefix:@"http"]) { + if ([super.bridge.bundleURL.scheme hasPrefix:@"http"]) { NSError *error; NSString *binaryAppVersion = [[CodePushConfig current] appVersion]; NSDictionary *currentPackageMetadata = [CodePushPackage getCurrentPackage:&error]; @@ -434,18 +434,18 @@ static NSString *bundleResourceSubdirectory = nil; */ - (void)loadBundle { - // This needs to be async dispatched because the _bridge is not set on init + // This needs to be async dispatched because the bridge is not set on init // when the app first starts, therefore rollbacks will not take effect. dispatch_async(dispatch_get_main_queue(), ^{ // If the current bundle URL is using http(s), then assume the dev // is debugging and therefore, shouldn't be redirected to a local // file (since Chrome wouldn't support it). Otherwise, update // the current bundle URL to point at the latest update - if ([CodePush isUsingTestConfiguration] || ![_bridge.bundleURL.scheme hasPrefix:@"http"]) { - [_bridge setValue:[CodePush bundleURL] forKey:@"bundleURL"]; + if ([CodePush isUsingTestConfiguration] || ![super.bridge.bundleURL.scheme hasPrefix:@"http"]) { + [super.bridge setValue:[CodePush bundleURL] forKey:@"bundleURL"]; } - [_bridge reload]; + [super.bridge reload]; }); }