How to get people to rate your IOS app

  • このエントリーをはてなブックマークに追加
    2012/04/07
  • iPhone

How to display UIAlert like “Rate this application” when application starts.

NewImage

You should write about UIAlert to didFinishLaunchingWithOptions.

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    CGRect frameForWindow = [[UIScreen mainScreen] bounds];
    window = [[UIWindow alloc] initWithFrame:frameForWindow];

    //write about window
    //ウインドウについて記載

    [window addSubview:navigationController.view];

    //From here about UIAlert and rating popup.
    //manage displaying UIAlert by NSUserDefaults
    //ここからUIAlertについて記載。表示するかどうかはNSUserDefaultsで制御する。
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    NSInteger executeTime = [userDefaults integerForKey: @"executeTime"];
    NSInteger alertDispFlag = [userDefaults integerForKey: @"alertDispFlag"];

    executeTime++;

    //If this application is started 6 times or more and alertDispFlag == 0, then alert is displayed.
    //もし6回以上起動していて、alertDispFlagが0なら表示する
    if (executeTime > 5 && alertDispFlag == 0) {
        // アラート表示

        UIAlertView *alertView = [[UIAlertView alloc] init];
        alertView.delegate = self;
        alertView.title=NSLocalizedString(@"pleaseReview", @"Please Rate");
        alertView.message=NSLocalizedString(@"appliciate", @"Please Rate this apps.");
        [alertView addButtonWithTitle:NSLocalizedString(@"Review", @"Rate now.")];
        [alertView addButtonWithTitle:NSLocalizedString(@"Later", @"Remind me later.")];
        [alertView addButtonWithTitle:NSLocalizedString(@"nothanks", @"No, thanks.")];
        [alertView show];
        [alertView release];

    }

    [userDefaults setInteger:executeTime forKey: @"executeTime"];
    [userDefaults synchronize];

    return YES;
}

//UIAlartのデリゲート。UIAlertの動作を記載する。
//delegate to UIAlret

-(void)alertView:(UIAlertView*)alertView
clickedButtonAtIndex:(NSInteger)buttonIndex {

    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    switch (buttonIndex) {
        case 0:
            //go to rate page
            [userDefaults setInteger: 1 forKey: @"alertDispFlag"];
            [userDefaults synchronize];
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:NSLocalizedString(@"reviewURL", @"") ]];
            break;

        case 1:

            break;
        case 2:
            [userDefaults setInteger: 1 forKey: @"alertDispFlag"];
            [userDefaults synchronize];
            break;
    }

}

review URL is

itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=(9 digit itunes app id)&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software

One Response to “How to get people to rate your IOS app”

Leave a Reply

© 2017 samurai-apps. All rights reserved. Powered by WordPress Entries RSS Comments RSS