0
我想每个月都会发出一个提醒视图(例如每个月的第一天)以提醒用户对我的应用进行评分。我在第一次打开应用程序时搜索了打开警报视图的方法,但没有解决我的问题的答案。任何人都可以帮我用下面的代码。启动一个UIalert查看月度
非常感谢。
- (void)viewDidLoad{
[super viewDidLoad];
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSString *alreadyRun = @"already-run";
if ([prefs boolForKey:alreadyRun])
return;
[prefs setBool:YES forKey:alreadyRun];
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Rate and Comment" message:@"Thank you for choosing Art of Codes, your support could make this app better. Please rate and comment and tell us what you think."delegate:self cancelButtonTitle:@"Done" otherButtonTitles:@"Rate it!", nil];
[alert show];
}
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
// the user clicked one of the OK/Cancel buttons
if (buttonIndex == 0)
{
NSLog(@"ok");
}
else
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/"]];
}
}