-1
首先,对不起我的英文。 我遇到了创建多个本地通知的应用程序出现问题。我安排他们在一个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警报......我只是找不到为什么...有人可以帮助我吗? 谢谢
嗯..问题或答案? – kleopatra
@kleopatra这是问题与答案:P,如果你不添加此方法..然后这是答案,如果你添加这个,那么它不是:P –