From 0cd3aa0d9db91b7afaa2355268f2c58b32ac9ca2 Mon Sep 17 00:00:00 2001 From: Jakob Date: Sat, 14 Dec 2019 22:03:57 +0100 Subject: [PATCH 1/2] SUUpdater: Delay updater startup This should allow configuring the updater in willFinishLaunching: Should fix #1505 --- Sparkle/SUUpdater.m | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index 96345b54..af69e01e 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -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 (![_updater startUpdater:&updaterError]) { + SULog(SULogLevelError, @"Error: Failed to start updater with error: %@", updaterError); + abort(); + } + }); } return self; } From 771b193924bb3a1a074a47800650d7697e08473c Mon Sep 17 00:00:00 2001 From: Jakob Date: Sat, 14 Dec 2019 22:53:56 +0100 Subject: [PATCH 2/2] Use self to avoid warning --- Sparkle/SUUpdater.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index af69e01e..66743b58 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -84,7 +84,7 @@ static NSMutableDictionary *sharedUpdaters = nil; // either in applicationWillFinishLaunching: or by setting properties right after initialisation dispatch_async(dispatch_get_main_queue(), ^{ NSError *updaterError = nil; - if (![_updater startUpdater:&updaterError]) { + if (![self.updater startUpdater:&updaterError]) { SULog(SULogLevelError, @"Error: Failed to start updater with error: %@", updaterError); abort(); }