我想处理重复通知并让它在第一次触发时增加应用程序徽章编号的唯一方法是安排没有徽章编号的重复通知,例如:
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:60];
localNotification.alertBody = @"1";
localNotification.alertAction = @"Send";
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.repeatInterval = NSMinuteCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
然后在第一次触发重复通知的同时安排一个仅设置应用程序徽章编号的通知:
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:60];
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.applicationIconBadgeNumber = 1;
localNotification.hasAction = NO;
localNotification.alertBody = nil;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];