-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 –