Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
542 views
in Technique[技术] by (71.8m points)

iphone - App Store Review Button

How can we make the "please leave us a review in the app store" functional PopUp in an iOS app?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It's quite easy. Create an action rateGame and change the id 409954448 to your app id.

- (IBAction)rateGame {
    [[UIApplication sharedApplication] 
     openURL:[NSURL URLWithString:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=409954448"]];         
}

This will launch the AppStore app and take the user directly to the page where s/he can rate and review your app. If you want this to happen after, say, 20 times the user loads your app, then you can add an alert in viewDidLoad of your main page:

- (void)viewDidLoad {
    [super viewDidLoad];

    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    NSInteger launchCount = [prefs integerForKey:@"launchCount"];
    if (launchCount == 20) {
        launchCount++;
        [prefs setInteger:launchCount forKey:@"launchCount"];
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"LIKE MY APP?" 
                                                        message:@"Please rate it on the App Store!"
                                                       delegate:self 
                                              cancelButtonTitle:@"NO THANKS" 
                                              otherButtonTitles:@"RATE NOW", nil];
        [alert show];
        [alert release];                
    }

}

This assumes you've set up the launchCount in the AppDelegate:

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

    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    NSInteger launchCount = [prefs integerForKey:@"launchCount"];
    launchCount++;
    [prefs setInteger:launchCount  forKey:@"launchCount"];  

// YOUR CODE HERE

}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...