Skip to content

ty0x2333/TYUpdatePrompt

Repository files navigation

TYUpdatePrompt

Remind the user to update the application when a new version is available.

CI Status Version License Platform

Usage

Check Version
TYUpdatePrompt *updatePrompt = [TYUpdatePrompt sharedInstance];
[updatePrompt checkVersionWithCompletionHandler:^(BOOL isNeedUpdate, NSString *appName, TYUPAppStoreInfo *appStoreInfo) {
    if (isNeedUpdate) {
        NSString *title = @"Update Available";
        NSString *message = [NSString stringWithFormat:@"A new version of %@ is available. Please update to version %@ now.\n\nRelease Notes\n\n%@",
                             appName,
                             appStoreInfo.version,
                             appStoreInfo.releaseNotes];
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
                                                            message:message
                                                           delegate:self
                                                  cancelButtonTitle:nil
                                                  otherButtonTitles:@"Update", @"Next time", nil];
        [alertView show];
    }
}];
Check Version Daily
TYUpdatePrompt *updatePrompt = [TYUpdatePrompt sharedInstance];
[updatePrompt checkVersionDailyWithCompletionHandler:^(BOOL isNeedUpdate, NSString *appName, TYUPAppStoreInfo *appStoreInfo) {
    ...
}];
Check Version Weekly
TYUpdatePrompt *updatePrompt = [TYUpdatePrompt sharedInstance];
[updatePrompt checkVersionWeeklyWithCompletionHandler:^(BOOL isNeedUpdate, NSString *appName, TYUPAppStoreInfo *appStoreInfo) {
    ...
}];

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

TYUpdatePrompt is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "TYUpdatePrompt"

License

TYUpdatePrompt is available under the MIT license. See the LICENSE file for more info.

About

Remind the user to update the application for iOS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published