test if update is available

Asked by Jack James

Hello
First of all, I am new to Cocoa, so probably what I'm trying to do is easy, but it's due to my lack of knowledge...

That said, I have a wrapper application which launches a bundled application and then immediately quits (using [NSApp terminate:nil]).
I would like to include Sparkle in this wrapper (it's not going to be possible to include if for the bundled app itself), and I've implemented it without any issues: so long as I comment out the NSApp terminate line.
The wrapper itself has no windows, so I can use:
-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
{
 return YES;
}
to terminate the wrapper after the sparkle window is dismissed. This only works though, if there is actually an update. So want I really want to do is have some code that checks if there is an update available, and if not, then terminate the wrapper at the end.

I know this can probably be done with checkForUpdateInformation, but as this method doesn't return a value, I'm not sure how to proceed.

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Sparkle Edit question
Assignee:
No assignee Edit question
Solved by:
Andy Matuschak
Solved:
Last query:
Last reply:
Revision history for this message
Andy Matuschak (andymatuschak) said :
#1

Ah, yes, checkForUpdateInformation is what you want, but it's asynchronous. Just implement the appropriate delegate methods found in SUUpdater.h.

Revision history for this message
Jack James (jack-surrealroad) said :
#2

Thanks. Is there any sample code I can look at that shows this in action?

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

Not really. Just set one of your classes as delegate of your SUUpdater, and implement:

- (void)updater:(SUUpdater *)updater didFindValidUpdate:(SUAppcastItem *)update;
and
- (void)updaterDidNotFindUpdate:(SUUpdater *)update;

That should give you all the info you need.

Revision history for this message
Jack James (jack-surrealroad) said :
#4

Thanks Andy Matuschak, that solved my question.