您似乎正在提醒您在应用商店中评价您的应用,而不是回答您的直接(技术)问题,我将尝试解决更大的问题。您应该考虑使用现有的开源解决方案来处理提示用户进行评论,您可以控制诸如多少次启动/天后提示他们的功能。
我可以推荐Arash Pyan 的 Appirater。它的作用是自动处理应用程序的评分部分。它将用户直接带到您的应用程序的评论页面,并且它非常可定制。新开发人员的最佳解决方案!它在 GitHub 上可用。
demosthenese 的iRate是一个类似的解决方案,但更清洁并支持快速的应用程序切换。
改用这些“现成的”解决方案!它应该工作得更好,而不是自己处理!它们包括有关如何自定义功能的文档和示例。
顺便说一句,我认为 Apple 不建议使用 AlertViews 来让用户对应用程序进行评分。负责任地使用提到的工具。不要太快地提示用户,并确保您包含一个永久关闭按钮!
如果您在这里寻求问题的技术解决方案(即在 Prompt on launch 中使用永久关闭按钮),以下是您应该做什么的概述:
-(void)viewdidload{
//Access NSUSerDefaults and check a variable called launch
// launch's default value is 0
if (launch == 0) {
alert = [[UIAlertView alloc] initWithTitle:@"Rate!" message:@"You'll see this everytime you launch until you click Dismiss Forever" delegate:self cancelButtonTitle:@"Not Now" otherButtonTitles:@"Okay! ", @"Dismiss Alert and Don't Show it to me", nil ];
[alert show];
[alert release];
}
}
else
{
//nothing
}
//continue customizing
}
-(void)alertView:(UIAlertView *) alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0)
//Assume this is the Okay Button
{
//Now use NSUserDefaults and set a variable called launch to 1
// the default value for launch should be 0
// now that its set to 1
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"ILoveAlertViews.com" ]];
}
if (buttonIndex == 1) {
//assume this is the dismiss button
//Now use NSUserDefaults and set a variable called launch to 2
//2 means that they never want to see it. The AlertView should not be called on the next launch
}
}