[![CI Status](http://img.shields.io/travis/Dustin Bachrach/HNDAppUpdateManager.svg?style=flat)](https://travis-ci.org/Dustin Bachrach/HNDAppUpdateManager)
HNDAppUpdateManager lets you easily add app update checking to your iOS apps. It supports App Store or Enterprise distribution.
HNDAppUpdateManager is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "HNDAppUpdateManager"
The App Update Manager requests a version JSON file, which you host on your server. The JSON file contains 3 fields:
Field | Description | Example |
---|---|---|
latestVersion | A full version string including build number. | "1.2.0.50" |
updateUrl | A URL which will initiate update. Can be an enterprise itms-services URL or an app store link |
"itms-services://?action=download-manifest&url=https://myapp.com/app.plist" |
requireUpdateBefore | (Optional) A full version string that indicates when an update is required. Any version before this version will be required. | "1.1.5.0" |
Here is an example JSON file:
{
"latestVersion": "1.2.0.50",
"updateUrl": "itms-services://?action=download-manifest&url=https://myapp.com/app.plist",
"requireUpdateBefore": "1.1.5.0"
}
If you use Fastlane for s3 Enterprise distrubution, you already get a version.json
generated for you automatically.
You can then easily check for updates from inside your AppDelegate or wherever you choose:
NSURL* versionURL = [NSURL URLWithString:@"http://myapp.com/version.json"];
HNDAppUpdateManager* updateManager = [[HNDAppUpdateManager alloc] initWithVersionURL:versionURL];
updateManager.delegate = self;
[updateManager checkForUpdate];
- (void)appUpdateManager:(HNDAppUpdateManager*)manager
promptForUpdateForcibly:(BOOL)forced
updateBlock:(void(^)())updateBlock {
if (forced) {
// Show an alert and then call updateBlock()
}
else {
// Ask the user if they want to update.
// If they do, call updateBlock()
}
}
Dustin Bachrach, dustin@mediahound.com
HNDAppUpdateManager is available under the Apache License 2.0. See the LICENSE file for more info.