Does Sparkle framework work with System Preferences?

Asked by tornado

Simple question really - does it work with Mac OS X System Preferences? Reason I ask is when I add the framework to my System Preference, I get an error "Preferences Pane - Could not load XXX preference pane.". When I remove the framework, it loads fine. I'm guessing it won't work but I wanted to doublecheck.

Thanks,

Joe

Question information

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

Sparkle 1.5 added support for updating arbitrary bundles, and though I haven't tested that support specifically with a prefpane, it really should work. I'm guessing your problems are due to my nonexistent documentation (sorry about that—I'm working on it!)

This is only mentioned in the release notes, but if you'd like to update a bundle which *isn't* the host app (System Preferences.app in this case), you must call setHostBundle: on the SUUpdater to let it know what you want to monitor. Otherwise, it has no idea.

If it still fails, check the console for more information.

Revision history for this message
tornado (joe-flexgames) said :
#2

Andy,

Thanks. I did move the framework to ~/Library/Frameworks (and weak linked it) and now my System pref loads into the System Preferences without the error. I'm now getting the "You must specify the URL of the appcast as the SUFeedURL Key error.

I have the key in both my Info.plist and my user defaults plist file. Any idea why these wouldn't be seen and trigger this error?

Thanks,
Joe

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

Are you sure you called [[SUUpdater sharedUpdater] setHostBundle:myBundle] somewhere in your code? If you're sure, can you email me the project or some small part of it? (<email address hidden>)

Revision history for this message
tornado (joe-flexgames) said :
#4

Andy,

Pardon my ignorance, but I hadn't added that line. When I do, it tells me that SUUpdater is not recognized. I'm assuming I need to #include something from the framework?

Here's what I've done so far:
1) Weak linked the Sparkle.framework (which is in ~/Library/Frameworks) to my linked frameworks folder in my project
2) Instantiated an Updater object in my NIB.
3) created a button in my prefpane window called "update"
4) connected update to "CheckForUpdates" in the Updater object in my NIB.
5) added the line you referred to (actually made it [[SUUpdater sharedUpdater] setHostBundle:self];)

I'm stuck now - can you advise? Sort of new to Cocoa programming if you could not tell.
Thanks,
Joe

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

Hey, Joe, a couple things:

- first, you need to #import <Sparkle/Sparkle.h> to let your code know about SUUpdater.
- second, setHostBundle: takes an NSBundle, so you don't want to use self. Check out the NSBundle documentation at http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/Reference/Reference.html; you should be able to use [NSBundle bundleForClass:[self class]] to get the appropriate bundle reference.

I think this'll fix it for you.

Revision history for this message
tornado (joe-flexgames) said :
#6

It worked! Thanks so much for sticking with me. Excited to use your framework.

Revision history for this message
Peter Speck (speck) said :
#7

To embed the Framework inside your Preferences Panel bundle, you need to fix the library path of the Sparkle Framework too. You don't need to weak link the Sparkle Framework - the reason for "Could not load XXX preference pane" is that it can't find the Sparke Framework at runtime, and weaklinking just makes your panel run without the framework.

Please don't install a Framework in ~/Library/Framework folder (nor the global /Library), as that leads to all sort of incompability nightmare down the road. Java users have been bitten hard by 3rd party apps installing global libraries.

See question 37125 for the Xcode script to fix the dyld path:
https://answers.launchpad.net/sparkle/+question/37125
This fixes the linking. You'll still need to call setHostBundle.

Revision history for this message
tornado (joe-flexgames) said :
#8

Peter - I posted a followup question to your post above on question 37125. Thanks.