我正在使用UILocalNotification。我的應用程序會讓用戶設施爲我的應用程序中的任何會議和藥品設置提醒。當我設置過去的日期通知時,UILocal Notification未按計劃日期和時間觸發
我可以根據我的日程安排日期安排日程安排。當用戶將安排過去的日期通知時,我的secound日程安排通知不會被解僱。在偵察到其他人正在發射完美之後,但是並沒有發射。
以下是我的通知流程:
我滿足了當時一個創建3時間表是我目前的時間過去說的如2014-01-28 18:00。而我目前的設備時間是2014-01-28 19:00。現在我正在創建另一個時間表,即2014-01-28 19:10。另一個日程安排日期和時間即2014-01-28 19:20。
有了上述時間表日期時間參考,我的第一個過去的日期通知是在創建計劃後觸發的。
當我當前的設備時間到2014-01-28 19:10。我正在看通知。但它撲滅了火焰。
並在2014-01-28 19:20我的第三次通知會定期觸發。當我把過去的日期作爲一個時間表添加時,每次都會發生這種事情。
以下是我的日程安排通知代碼這是我用來安排通知:
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = fireDate;
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.alertBody = alertText;
localNotification.alertAction = alertAction;
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.alertLaunchImage = launchImage;
localNotification.applicationIconBadgeNumber = 1;
localNotification.userInfo = userInfo;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
[[UIApplication sharedApplication]registerForRemoteNotificationTypes:
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeSound];
而且以下是我idReceiveLocalNotification:方法hendle通知:
if([UIApplication sharedApplication].applicationIconBadgeNumber == 0) {
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];
}else{
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
}
而且當我得到通知那時我會打電話給MkLocalNotificationScheduler類來顯示警報,其代碼如下:
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Reminder"
message:[thisNotification alertBody]
delegate:self
cancelButtonTitle:@"NO"
otherButtonTitles:@"YES",nil] autorelease];
alert.tag = 1;
[alert performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES];
請幫助我如何獲得所有時間表通知天氣它是過去的日期或日期還沒有來。
感謝您的回覆,但我必須向用戶顯示警報,然後如何纔有可能。 –
你不爲過去的事件。如果你想表現出類似嘿你的會議已經過期,那麼你不要使用UILocalNotification。在您的應用程序午餐後,您需要在應用程序中進行邏輯/計算,並顯示彈出警報。 –