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
2
3
4
5
6
7
8
9
platform :osx, '11.0'

target 'MyApp' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!

pod 'Sparkle'

end

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
2
3
4
@IBAction func checkForUpdates(_ sender: Any) {
let updater = SUUpdater.shared()
updater?.checkForUpdates(self)
}

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
2
<key>SUFeedURL</key>
<string>https://onmyway133.com/MyAppCast.xml</string>

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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Sparkle Test App Changelog</title>
<link>http://sparkle-project.org/files/sparkletestcast.xml</link>
<description>Most recent changes with links to updates.</description>
<language>en</language>
<item>
<title>Version 2.0</title>
<description>
<![CDATA[
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>Suspendisse sed felis ac ante ultrices rhoncus. Etiam quis elit vel nibh placerat facilisis in id leo.</li>
<li>Vestibulum nec tortor odio, nec malesuada libero. Cras vel convallis nunc.</li>
<li>Suspendisse tristique massa eget velit consequat tincidunt. Praesent sodales hendrerit pretium.</li>
</ul>
]]>
</description>
<pubDate>Sat, 26 Jul 2014 15:20:11 +0000</pubDate>
<enclosure url="https://sparkle-project.org/files/Sparkle%20Test%20App.zip" sparkle:version="2.0" length="107758" type="application/octet-stream" sparkle:dsaSignature="MCwCFCdoW13VBGJWIfIklKxQVyetgxE7AhQTVuY9uQT0KOV1UEk21epBsGZMPg==" />
</item>
</channel>
</rss>

Updated at 2021-01-26 06:34:38

Comments

You need to set client_id and slot_id to show this AD unit. Please set it in _config.yml.