如果我按照下面的代码设置我的通知,它会每分钟启动一次警报。但是,即使我的警报设置在当前时间之后,它也会被触发。例如,当前时间为12:00,闹钟时间为9:00,因为kCFCalendarUnitMinute是一个循环,它仍然会被触发。
如何将该功能作为我的标题说明?
UILocalNotification *localNotification = [UILocalNotification new];
localNotification.userInfo = @{@"status":@"alarm",@"note":noteString,@"index":@(index)};
localNotification.fireDate = dateToFire;
localNotification.alertTitle = @"Alarm";
localNotification.alertBody = @"Wake Up!";
localNotification.soundName = @"myTone.m4a";
localNotification.alertAction = @"View";
localNotification.repeatInterval = kCFCalendarUnitMinute;
localNotification.regionTriggersOnce = true;
localNotification.applicationIconBadgeNumber =
[UIApplication sharedApplication].applicationIconBadgeNumber + 1;
localNotification.timeZone = [NSTimeZone systemTimeZone];
// To set the local notification
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];