弹出这个时机很重要,毕竟客户也是相当厌烦弹窗和通知这类东西动不动就弹一个选择题,妨碍其他操作,很不友好,但是有些功能需要在适当的时机弹出来告知用户一些私人定制的信息和操作...
譬如:
///MARK: -引导添加App Store的评论
- (void)guideAppstoreComment{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
BOOL isNotGuide = [[defaults objectForKey:@"isNotGuideAppstore"] boolValue];
if (isNotGuide) {
return ;
}
//跳转到评价页面
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"评价一下" message:@"我们拼了命加班,只希望那个您能用的爽。给个五星好评吧亲!" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"五星好评" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSString *str = [NSString stringWithFormat: @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&id=%@",KJJYSAPPID];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}];
UIAlertAction *action2 =[UIAlertAction actionWithTitle:@"稍后评价" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
}];
UIAlertAction *action3 =[UIAlertAction actionWithTitle:@"不再提示" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[defaults setObject:@"YES" forKey:@"isNotGuideAppstore"];
[defaults synchronize];
}];
[alertVC addAction: action1];
[alertVC addAction: action2];
[alertVC addAction: action3];
[self presentViewController: alertVC animated:YES completion:^{
}];
}