首先,对不起我的英语。我遇到了一个创建多个本地通知的应用程序的问题。我将它们安排在一个 for 循环中:
for (int i = 0; i < 100 ; i++) {
compteur++;
UILocalNotification *prototypeNotification = [[UILocalNotification alloc] init];
prototypeNotification.timeZone = [NSTimeZone defaultTimeZone];
prototypeNotification.applicationIconBadgeNumber = 0;
prototypeNotification.alertBody = @"ALERTE PILULE !!!!!";
prototypeNotification.alertAction = @"Ok";
[prototypeNotification setSoundName:UILocalNotificationDefaultSoundName];
prototypeNotification.fireDate = itemDate;
[[UIApplication sharedApplication] scheduleLocalNotification:prototypeNotification];
[prototypeNotification release];
itemDate = [[NSCalendar currentCalendar] dateByAddingComponents:comps toDate:itemDate options:0];
if (compteur == 21) {
compteur = 0;
itemDate = [[NSCalendar currentCalendar] dateByAddingComponents:comps2 toDate:itemDate options:0];
}
}
当firedate来了时,它运行良好,但有时它不仅显示一个,而且显示2个或3个或6个警报......我就是找不到原因......有人可以帮助我吗?谢谢