App Store评论button

我们如何在iOS应用程序中创build“ 请在应用程序商店中留下评论 ”functionPopUp?

我个人使用这个。 我认为它工作得很好。 http://arashpayan.com/blog/2009/09/07/presenting-appirater/

这很容易。 创build一个动作rateGame ,并将ID为409954448的ID改为您的应用ID。

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

这将启动AppStore应用程序,并将用户直接带到他/她可以评价和查看您的应用程序的页面。 如果您希望在用户加载应用程序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]; } } 

这假设你已经在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 } 

如果您希望用户在20次后查看您的应用程序,则会丢失代码。 缺less的部分是

 - (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"]]; } } 

那么, 这是一个。

这些通常用简单的UIAlertViews来完成,它有三个button(Review Now,Later,Never),并在NSUserDefaults中存储首选项,以表明用户是否已经这样做了,是否不希望被再次询问等等。

iRate也是另一个很好的图书馆,提供“评价这个应用程序”对话框。