我想每分钟发送一次本地通知,这是我正在使用的代码:
[[UIApplication sharedApplication] cancelAllLocalNotifications];
UILocalNotification *notif = [[UILocalNotification alloc] init];
if (notif == nil) {
return;
}
notif.timeZone = [NSTimeZone defaultTimeZone];
notif.alertBody = @"Test notification!";
notif.alertAction = @"View";
notif.soundName = UILocalNotificationDefaultSoundName;
notif.applicationIconBadgeNumber += 1;
notif.repeatInterval = NSMinuteCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:notif];
通知只开始一次,从不重复。我在哪里弄错了?