How to use Sparkle for macOS app
Issue #762
Install Sparkle
- For now, the latest stable version is 1.24.0 which supports CocoaPods OK, but still, have issues with SPM. Support non sandboxed apps
- Version 2.0.0 is in beta and supports sandboxed apps
To install, use CocoaPods
1 | platform :osx, '11.0' |
Sign
In your target, choose Signing & Capability tab, change Signing Certificate from Locally to Development for code sign to work for embedded frameworks
Specify SUUpdater
Follow Sparkle documentation, let’s add an Object to Application Scene in Main.storyboard and specify SUUpdater class
In AppDelegate
1 | func checkForUpdates(_ sender: Any) { |
Additionally, we can add an NSMenuItem and drag it to our SUUpdater object checkForUpdates method
In Info.plist, add SUFeedURL with a link to your cast file
1 | <key>SUFeedURL</key> |
Configure cast file
I usually upload my cast to S3 or GitHub. For GitHub with raw URL, remember that there is 5 minutes cache by default
If you follow sample cast file https://sparkle-project.org/files/sparkletestcast.xml
Notice that sparkle:version="2.0" is CFBundleVersion which is your build number. You need to also specify sparkle:shortVersionString which is CFBundleShortVersionString your version number
1 | sparkle:shortVersionString="2.0.1" |
1 |
|
Updated at 2021-01-26 06:34:38