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