前端框架选型是企业提升开发效率与用户体验的关键因素
909
2022-10-11
GitHubUpdates:从GitHub发布的版本来安装应用程序更新的Cocoa框架
GitHubUpdates
About
GitHubUpdates is Cocoa framework to install application updates from GitHub releases. If you ever used Sparkle, this project provided the same kind of functionalities, but works with your GitHub releases and tags.
Documentation
Documentation and API reference can be found at: http://doc.xs-labs.com/GitHubUpdates/
How to use
Application Setup
The project provides a Cocoa framework that you can embed into your own application. A module is also defined, so you can either use:
@import GitHubUpdates;
or:
#import
In order to check for updates, a GitHubUpdater object needs to be created:
self.updater = [ GitHubUpdater new ];self.updater.user = @"MyGitHubUsername" self.updater.repository = @"MyGitHubRepository";
Note that you can also create the GitHubUpdater instance with InterfaceBuilder. The user and repository properties are inspectable, so you can set them with the Interface Builder inspector palette.
You can then check for updates using the IB action:
[ self.updater checkForUpdates: nil ];
This method will show a progress window, while checking for available updates. You can also choose to check for updates in background:
[ self.updater checkForUpdatesInBackground ];
With this method, the update window will only be shown if an update is available.
You can also check for updates periodically, using a timer:
[ NSTimer scheduledTimerWithTimeInterval: 3600 target: self.updater selector: @selector( checkForUpdatesInBackground ) userInfo: nil repeats: YES ];
This will check for updates every hour.
Create a release on GitHub
GitHubUpdates will check your GitHub tags to see if an update is available.
Your tags should correspond to the application's version number, as in CFBundleShortVersionString. There's no built-in support for CFBundleVersion, but that behaviour can be customized with GitHubUpdaterDelegate if needed.
Tags can be created on GitHub the following way:
git tag 0.1.2 -m "0.1.2"git push origin --tags
Once you created a new tag, you'll need to upload a ZIP archive or a DMG file of your application to GitHub. Also note that your application should be at the first level of the ZIP archive or the DMG file.
Note that the installer will check the value of CFBundleIdentifier, so they need to match.
Code-Signing
For obvious security reasons, the installer will also check code-signing properties.
While you can use GitHubUpdates without code-signing, the installer will refuse to install a non code-signed version, if the current version is code-signed. Code-signing identities are also checked, and the installer will refuse to install an update if there's a mismatch in the code-signing identities.
License
GitHubUpdates is released under the terms of the MIT license.
Repository Infos
Owner: Jean-David Gadina - XS-LabsWeb: xs-labs.comBlog: noxeos.comTwitter: @macmadeGitHub: github.com/macmadeLinkedIn: ch.linkedin.com/in/macmade/StackOverflow: stackoverflow.com/users/182676/macmade
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~