Bundles can't ask for permission to update; developers have to hard-code YES for SUEnableAutomaticChecks

Bug #312381 reported by Andy Matuschak
4
Affects Status Importance Assigned to Milestone
Sparkle
Confirmed
Medium
Unassigned

Bug Description

So unfortunately, right now, Sparkle doesn't support asking for permission to update for bundles. And resetUpdateCycle uses whatever settings the user has to set an appropriate schedule. But if the user is never asked for permission, then there are no settings, and so no update will be scheduled, and there's no way for a bundle to make the permission UI happen.

This sucks, and I'll fix it someday. In the meantime, set SUEnableAutomaticChecks to YES in your Info.plist. Sorry about that.

Changed in sparkle:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Hofman (cmhofman) wrote :

I wonder how this ever could be fixed. There is no way of knowing whether the hosting app has already finished launching when the bundle loads, and asking too early or twice is wrong.

Revision history for this message
Andy Matuschak (andymatuschak) wrote :

There should be exposed API for launching the permissions prompt. It's just poorly-designed. Everything's too coupled.

Revision history for this message
Hofman (cmhofman) wrote :

That by itself is not enough, that's my point. The problem is that a plugin or app developer (and certainly not Sparkle) may not know when, or even whether, such a call should be made. The point is that the prompt should be called immediately when the app has already finished launching, but it should be delayed until applicationDidFinishLaunching when the app has /not/ finished launching yet. However, there is no way to figure out which situation you're in at the time of initWithBundle:, because the private NSApplication ivar _appFlags._finishedLaunching is not exposed through a public accessor.

However, I found a solution, and it's pretty simple. If you call the -applicationDidFinishLaunching: method using -performSelector:withObject:afterDelay: with a delay of 0 /instead of/ using NSApplicationDidFinishLaunchingNotification, it will work exactly the same way for app bundles (because delayed methods are called by a runloop timer, and the runloop does not start before applicationDidFinishLaunching), while for plugins loaded /after/ this time, it's performed almost immediately. So it will /always/ be called, and is /guaranteed/ to be called after the app has finished launching. Exactly what's needed.

Revision history for this message
Hofman (cmhofman) wrote :
Revision history for this message
Andy Matuschak (andymatuschak) wrote :

Ah, that's a very clever patch! Thanks! It's in r326.

Testing help would be appreciated!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.