简体   繁体   English

App Store 审核按钮

[英]App Store Review Button

How can we make the " please leave us a review in the app store " functional PopUp in an iOS app?我们如何在 iOS 应用程序中制作“请在应用商店中给我们留下评论”功能弹出窗口?

It's quite easy.这很容易。 Create an action rateGame and change the id 409954448 to your app id.创建一个 action rateGame并将 id 409954448更改为您的应用程序 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.这将启动 AppStore 应用程序并将用户直接带到她/他可以对您的应用程序进行评分和评论的页面。 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:如果您希望在用户加载您的应用程序 20 次之后发生这种情况,那么您可以在主页的viewDidLoad中添加警报:

- (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:这假设您已经在 AppDelegate 中设置了 launchCount:

- (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

}

I personally used this one.我个人用过这个。 I think it works really well.我认为它运作良好。 http://arashpayan.com/blog/2009/09/07/presenting-appirater/ http://arashpayan.com/blog/2009/09/07/presenting-appirater/

There is code missing if you want user to review your app after 20 times.如果您希望用户在 20 次后查看您的应用程序,则缺少代码。 The missing part is缺少的部分是

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 0)
    {
        // user hit dismiss so don't do anything
    }
    else if (buttonIndex == 1) //review the app
    {

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

    }
}

Well, here's one.嗯, 这是一个。

These are usually done as simple UIAlertViews with three buttons (Review Now, Later, Never) with preferences stored in NSUserDefaults to indicate whether the user has already done so, whether they never wish to be asked again, etc.这些通常作为简单的 UIAlertViews 完成,带有三个按钮(Review Now、Later、Never),其首选项存储在 NSUserDefaults 中,以指示用户是否已经这样做,他们是否不想再被询问等。

iRate is also another good library to present "rate this app" dialog boxes. iRate也是另一个展示“评价这个应用程序”对话框的好库。

Since iOS 10.3 iOS provides a feature for this.由于 iOS 10.3 iOS 为此提供了一个功能。

import StoreKit
SKStoreReviewController.requestReview()

A complete class how to request Appstore Reviews can be found on my GitHubAccount.完整的 class 如何请求 Appstore 评论可以在我的 GitHubAccount 上找到。

Cheers!干杯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM