我目前设置了本地通知,以便用户可以在 datePicker(小时、分钟和上午/下午)上选择他们想要发送通知的时间。它工作正常......直到第二天。通知似乎只在同一天有效,并在午夜到来时重置。如何防止闹钟重置,以便每天发送通知?
到目前为止,这是我的代码:
(IBAction)scheduleNotification:(id)sender {
UILocalNotification *notification = [[UILocalNotification alloc]init];
NSDate *fireDate = _datePicker.date;
[notification setFireDate:fireDate];
[notification setAlertBody:@"Daily Reminder"];
[notification setAlertAction:@"Go to app"];
[[UIApplication sharedApplication]scheduleLocalNotification:notification];
//Local push notifications
}
(IBAction)didChangeDatePicker:(id)sender {
NSLog(@"New reminder time selected: %@",self.datePicker.date);
}