Merge pull request #1524 from jakob/issue-1505

Sparkle 2.x: Delay startup of updater
This commit is contained in:
Kornel authored and GitHub committed 2019-12-15 17:05:27 +00:00
commit a045f1a50b
1 file changed
+9 -5
+9 -5
View File
@@ -80,11 +80,15 @@ static NSMutableDictionary *sharedUpdaters = nil;
_userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:bundle delegate:self];
_updater = [[SPUUpdater alloc] initWithHostBundle:bundle applicationBundle:bundle userDriver:_userDriver delegate:self];
NSError *updaterError = nil;
if (![_updater startUpdater:&updaterError]) {
SULog(SULogLevelError, @"Error: Failed to start updater with error: %@", updaterError);
abort();
}
// Delay starting the updater, so that the host has a chance to configure the updater
// either in applicationWillFinishLaunching: or by setting properties right after initialisation
dispatch_async(dispatch_get_main_queue(), ^{
NSError *updaterError = nil;
if (![self.updater startUpdater:&updaterError]) {
SULog(SULogLevelError, @"Error: Failed to start updater with error: %@", updaterError);
abort();
}
});
}
return self;
}