我想每隔一分钟发送本地通知,写出的代码:
[[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];
但是它只发送一次就不再发送了。不知道怎么改。请大家帮忙解决。