In my command-line application, when calling [[SUUpdater sharedUpdater] checkForUpdatesInBackground]
, project Sparkle does not place an HTTPS request on my webserver. I want a call to checkForUpdatesInBackground
to succeed, so I know my setup is right. I am using an Nginx webserver over HTTPS, and view the logs of this server to make sure the appcast.xml file is being requested.
I have tried debugging the Sparkle framework, and found out after calling checkForUpdatesInBackground
, the framework does call dispatch_async
in here. This gave the following stack trace.
2018-12-20 06:46:46.037297-0800 MyApplication[28705:224144] Stack trace : (
0 ??? 0x00000001005a7b0e 0x0 + 4300897038
1 MyApplication 0x0000000100001af0 main + 0
2 Sparkle 0x000000010036a5f9 -[SUAppcast fetchAppcastFromURL:inBackground:completionBlock:] + 1625
3 Sparkle 0x0000000100372fff -[SUBasicUpdateDriver checkForUpdatesAtURL:host:] + 1423
4 Sparkle 0x00000001003aabe5 -[SUUpdater checkForUpdatesWithDriver:] + 773
5 Sparkle 0x00000001003aa41e -[SUUpdater checkForUpdatesInBackground] + 494
6 MyApplication 0x0000000100001b9f main + 175
7 libdyld.dylib 0x00007fff5ddd1085 start + 1
)
My Info.plist:
{
"SUAllowsAutomaticUpdates" = NO;
CFBundleIconFile = "myicon.icns";
CFBundleExecutable = MyApplication;
"SUAutomaticallyUpdate" = NO;
"SUScheduledCheckInterval" = 3600;
"SUEnableAutomaticChecks" = NO;
SUPublicEDKey = "0xe+xaH4VBOMIADOqOqBAZug/hnrCqBKUyCffx+8Qvw=";
SUFeedURL = "https://test.myurl.com/appcast.xml";
CFBundleVersion = "1.0.0.0";
"CFBundleShortVersionString" = "7.0";
CFBundleIdentifier = "nl.apps.myapp";
}
My Code:
int main(int argc, const char * argv[]) {
@autoreleasepool {
[[SUUpdater sharedUpdater] checkForUpdatesInBackground];
}
}
Sparkle does halt the termination of my application in order to wait for the request to end. On my webserver I do not see the appcast.xml being requested, and Sparkle does not show a window with any update information.
In my case, like Rengers pointed out, Sparkle does not work because it is a command-line tool. This means there exists no main loop where Sparkle depends on. Sparkle places some of its actions on the main event queue using dispatch_async, for example here in the source code.
To overcome this, I've made my command-line tool into a GUI, and now it all works fine.