Check at startup in Sparkle v1.5b4

Asked by Bogdan Poplauschi

I am unable to implement the "Automatic Check at startup" feature on a Cocoa App using Sparkle v1.5b4. Please shortly describe the steps for this.

Question information

Language:
English Edit question
Status:
Answered
For:
Sparkle Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Andy Matuschak (andymatuschak) said :
#1
Revision history for this message
Bogdan Poplauschi (pbogdan) said :
#2

Andy, I've seen the tutorials. My problem is that I am using the 1.5b4 version. You written in the release notes for 1.5b1: We no longer distinguish between “check on startup” and “scheduled updates”; everything is scheduled, with the default being every day. I've tryed using the SUCheckAtStartup or the SUEnableAutomaticChecks, neither of them gave me the results I was expecting, which is CHECK AT STARTUP. Can this feature still be implemented using the v1.5b4, or you can only set an interval for autochecks.

Revision history for this message
Chunk1978 (chunk1978) said :
#3

i would also like to know how to do this: disable the automatic check prompt on the 2nd launch and just have it automated... binding a checkbox to SUEnableAutomaticChecks crashed my app with v1.5b4...

this is a stretch, but is it possible to trigger the check from my own code? say, to check only after an awakeFromNib sheet has ended and been ordered out?

Revision history for this message
Hofman (cmhofman) said :
#4

Have a look at the main header. To avoid the automatic prompt on 2nd launch there is an aptly named delegate method, or you just set SUEnableAutomaticChecks in the preferences. Also look into SUConstants .h for available keys, you'll see there's no SUCheckAtStartupKey. Sparkle mostly assumes a scheduled check. If you don't want that and want to explicitly check at startup you need to do so manually using e.g. checkForUpdatesInBackground.

Note that in the next version pref settings should be accessed instead as SUUpdater setters and getters.

Revision history for this message
Chunk1978 (chunk1978) said :
#5

so if i just comment out UUpdatePermissionPrompt.h in the main header file (Sparkle.h) like this:

//#import "SUUpdatePermissionPrompt.h"

than it won't ask on the 2nd launch to check automatically, but it will still check on the daily schedule? is that correct?

i'm using Sparkle 1.5b4

Revision history for this message
Chunk1978 (chunk1978) said :
#6

humm... nope!... that didn't seem to work too well, sparkle still asked me on the 2nd launch for update permissions...

so how is it possible to do this: essentially give the user no choice and always prompt when there is an actual update.

Revision history for this message
Andy Matuschak (andymatuschak) said :
#7

Bogdan: that's no longer a feature of Sparkle, but you can easily implement this functionality if you still want it (why?):

Tell Sparkle not to automatically check for updates (set that key to NO in Info.plist or call setAutomaticallyChecksForUpdates:NO on your SUUpdater). Then you can manually initiate the check when the app starts by calling checkForUpdatesInBackground on the SUUpdater on an applicationDidFinishLaunching notification.

Chunk: You want a different thing from Bogdan. Am I correct in understanding that you want to just have your app automatically check for updates, without prompting the user? If that's your goal, then just call setAutomaticallyChecksForUpdates:YES on an applicationDidFinishLaunching notification.

Revision history for this message
Chunk1978 (chunk1978) said :
#8

yes that's what i was asking... sorry i though we were asking the same thing... don't mean to hijack this thread, but i added what you said to my app controller and it still prompts to ask me on the 2nd launch... am i missing something here? this is my app controller:

#import <Sparkle/Sparkle.h>
#import "AppController.h"

@implementation AppController

- (
void
)applicationDidFinishLaunching:(NSNotification *)aNotification
 {
 setAutomaticallyChecksForUpdates:YES;
 }

Revision history for this message
Chunk1978 (chunk1978) said :
#9

i also tried:

- (
void
)applicationDidFinishLaunching:(NSNotification *)aNotification
 {
 [[SUUpdater sharedUpdater] setAutomaticallyChecksForUpdates:YES];
 }

but that returns a warning and doesn't work either...

sorry, i'm a little newish to cocoa.

Revision history for this message
Andy Matuschak (andymatuschak) said :
#10

Sorry for the confusion; that method is new since Sparkle 1.5b4; update to the latest bzr sources or wait for 1.5b5 (which should be within a few days).

Revision history for this message
Hofman (cmhofman) said :
#11

BTW, this is also wrong, as applicationDidFinishLaunching: may come too late. It should instead be called in applicationWillFinishLaunching:.

Can you help with this problem?

Provide an answer of your own, or ask Bogdan Poplauschi for more information if necessary.

To post a message you must log in.