Using Sparkle in Qt
Automatic Software update is a very important feature you need to implement in almost any product. Sparkle is an easy-to-use software update framework for macOS applications that answers this need and it can be integrated in almost any development environment. Here is how to integrate it into Qt farmework
Using the Sparkle framework with Qt:
Prerequisites:
Download the sdk from: https://sparkle-project.org/ and compile that project in XCode.
Add the Sparkle.framework file to /Library
Open Qt and find which compiler you are using:
Adding the framework and using it:
Copy the complied project (Sparkle.framework) to the complier lib path, and check that all links inside the Sparkle.framework work (have files in them).
Open your Qt .Pro file and add the following line:
LIBS += -framework Sparkle
Create a MacUtils.h class:
class MacUtils
{
public:
static void checkUpdates();
};
Create a MacUtils.mm file with objective C code:
#include "Sparkle/Sparkle.h"
#include <Sparkle/SUUpdater.h>
static SUUpdater* updater = [[SUUpdater sharedUpdater] retain];
void MacUtils::checkUpdates()
{
[updater setUpdateCheckInterval:3600];
[updater checkForUpdatesInBackground];
}
Configure the remote server and then add the remote host settings to the application by adding a DES key file to the bundle and the following keys to the plist file:
Now invoke the update function to check for updates
Note:
Some of the dependency problems can be solved by running: ~/Qt5.5.1/5.5/clang_64/bin/macdeployqt [path to the bundle]
this will invoke the otool application that adds dependencies to your application bundle
Recent Stories
Top DiscoverSDK Experts
Compare Products
Select up to three two products to compare by clicking on the compare icon () of each product.
{{compareToolModel.Error}}
{{CommentsModel.TotalCount}} Comments
Your Comment