Reputation: 26617
I'm trying to implement Sparkle in a brackets-shell application. I believe I have everything set up properly, but it seems to fail.
It will run through the update, find the update, get it ready and then when I hit the "Install and Relaunch" button, it will sit on the "Installing update..." screen indefinitely.
I thought that perhaps it was brackets-shell not wanting to close out its last child, so I tried to implement the updaterWillRelaunchApplication
delegate method. I tried adding it right before the function which I call to check for my updates, like this:
@implementation NSObject (SUUpdaterDelegateInformalProtocol)
- (void)updaterWillRelaunchApplication:(SUUpdater *)updater {
NSLog(@"Closing properly");
// code to close properly
}
@end
However, I never see that log message called, which I'm assuming means my delegate isn't being called.
So, I basically have two questions:
Thanks.
I've discovered a very odd and interesting behavior. If I don't have any of the windows (my app window or the Sparkle window) focused when it finishes the update, it will work completely fine. If I have either focused, what happens is my main window will close (like it's trying to restart), but the Sparkle window stays open. I then have to right-click and close the app.
However, if right after I hit the "Install and Relaunch" button I flip over to another application (like Chrome), it will go through just fine in the background. It seems that Sparkle won't close itself if it has focus. Very odd.
As kind of a workaround, I manually set the "enable automatic updates" to true so it does everything without that final window, which works... but isn't really ideal.
Upvotes: 2
Views: 940
Reputation: 19
Do you distribute your app via the app store? Had the same issue - distributing the app via HockeyApp.
It turned out that I had App Sandbox turned on in my capabilities, which lead to the described behaviour.
Sparkle uses NSTask launchedTaskWithLaunchPath:arguments: to replace the old app with the new one. In case of Sandbox entitlements and not distributing the app via the Apple App Store the NSTask is never finished due to missing access rights.
Additional information: https://developer.apple.com/documentation/foundation/nstask/1414375-launchedtaskwithlaunchpath
Upvotes: 0
Reputation: 11
I had a same issue like you have.After some head scratching moment i found out that inside sparkle.framework -->Resources-->Autoupdate. when i saw the contents it didnt have the Autoupdate as executable(Contents-->MacOS-->Autoupdate). After make it as executable it relaunched perfectly.
Upvotes: 1