If you would like to use your own UI, please use the following delegate method to obtain the localized update message if a new version is available:
如果你想使用自己的UI,如果有可用的新版本,使用下面的代理来获得本地化的升级信息(需要设置AlertTpye为HarpyAlertTypeNone)
Notify users when a new version of your app is available, and prompt them with the App Store link.
About
Harpy checks a user’s currently installed version of your iOS app against the version that is currently available in the App Store. If a new version is available, an alert can be presented to the user informing them of the newer version, and giving them the option to update the application.
Harpy is built to work with the http://www.semver.org system.
- Semantic Versioning is a three number versioning system (e.g., 1.0.0)
- Harpy also supports two-number versioning (e.g., 1.0)
- Harpy also supports four-number versioning (e.g., 1.0.0.0)
Swift Support
not support yet
Features
[x] Three types of alerts (see Screenshots & Alert Types)
[x] Optional delegate methods (see Optional Delegate section)
[x] Localized for 20+ languages
Screenshots
The left picture forces the user to update the app.
The center picture gives the user the option to update the app.
The right picture gives the user the option to skip the current update.
These options are controlled by the HarpyAlertType typede that is found in Harpy.h.
Installation Instructions
Manual Installation
Copy the ‘Harpy’ folder into your Xcode project. It contains the Harpy.h and Harpy.m files.
Setup
Import Harpy.h into your AppDelegate or Pre-Compiler Header (.pch)
In your AppDelegate, set the appID, and optionally, you can set the alertType.
In your AppDelegate, call only one of the checkVersion methods, as all three perform a check on your application’s first launch. Use either:
checkVersion in application:didFinishLaunchingWithOptions:
checkVersionDaily in applicationDidBecomeActive:.
checkVersionWeekly in applicationDidBecomeActive:.
-(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions{// Present Window before calling Harpy[self.windowmakeKeyAndVisible];// Set the App ID for your app[[HarpysharedInstance]setAppID:@"<#app_id#>"];// Set the UIViewController that will present an instance of UIAlertController[[HarpysharedInstance]setPresentingViewController:_window.rootViewController];// (Optional) Set the Delegate to track what a user clicked on, or to use a custom UI to present your message.[[HarpysharedInstance]setDelegate:self];// (Optional) The tintColor for the alertController[[HarpysharedInstance]setAlertControllerTintColor:@"<#alert_controller_tint_color#>"];// (Optional) Set the App Name for your app[[HarpysharedInstance]setAppName:@"<#app_name#>"];/* (Optional) Set the Alert Type for your app By default, Harpy is configured to use HarpyAlertTypeOption */[[HarpysharedInstance]setAlertType:<#alert_type#>];/* (Optional) If your application is not available in the U.S. App Store, you must specify the two-letter country code for the region in which your applicaiton is available. */[[HarpysharedInstance]setCountryCode:@"<#country_code#>"];/* (Optional) Overrides system language to predefined language. Please use the HarpyLanguage constants defined in Harpy.h. */[[HarpysharedInstance]setForceLanguageLocalization:<#HarpyLanguageConstant#>];// Perform check for new version of your app[[HarpysharedInstance]checkVersion];}-(void)applicationDidBecomeActive:(UIApplication*)application{/* Perform daily check for new version of your app Useful if user returns to you app from background after extended period of time Place in applicationDidBecomeActive: Also, performs version check on first launch. */[[HarpysharedInstance]checkVersionDaily];/* Perform weekly check for new version of your app Useful if you user returns to your app from background after extended period of time Place in applicationDidBecomeActive: Also, performs version check on first launch. */[[HarpysharedInstance]checkVersionWeekly];}-(void)applicationWillEnterForeground:(UIApplication*)application{/* Perform check for new version of your app Useful if user returns to you app from background after being sent tot he App Store, but doesn't update their app before coming back to your app. ONLY USE THIS IF YOU ARE USING *HarpyAlertTypeForce* Also, performs version check on first launch. */[[HarpysharedInstance]checkVersion];}
And you’re all set!
Differentiated Alerts for Patch, Minor, and Major Updates
If you would like to set a different type of alert for revision, patch, minor, and/or major updates, simply add one or all of the following optional lines to your setup before calling any of the checkVersion methods:
12345
/* By default, Harpy is configured to use HarpyAlertTypeOption for all version updates */[[HarpysharedInstance]setPatchUpdateAlertType:<#alert_type#>];[[HarpysharedInstance]setMinorUpdateAlertType:<#alert_type#>];[[HarpysharedInstance]setMajorUpdateAlertType:<#alert_type#>];[[HarpysharedInstance]setRevisionUpdateAlertType:<#alert_type#>];
Optional Delegate and Delegate Methods
If you’d like to handle or track the end-user’s behavior, four delegate methods have been made available to you:
1234567891011
// User presented with update dialog-(void)harpyDidShowUpdateDialog;// User did click on button that launched App Store.app-(void)harpyUserDidLaunchAppStore;// User did click on button that skips version update-(void)harpyUserDidSkipVersion;// User did click on button that cancels update dialog-(void)harpyUserDidCancel;
If you would like to use your own UI, please use the following delegate method to obtain the localized update message if a new version is available: