0
我這樣做是爲了在設定的時間內獲得警報。但它沒有及時提醒。我從datepicker設置時間。我如何解決這個問題?UILocalnotification沒有在設定的時間獲得警報?
- (void)scheduleNotificationWithInterval:(int)minutesBefore {
[[UIApplication sharedApplication] cancelAllLocalNotifications];
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
if (localNotif == nil)
return;
NSLog(@"Date %@",datePicker.date);
localNotif.fireDate = datePicker.date;
localNotif.timeZone = [NSTimeZone defaultTimeZone];
if ([freq isEqualToString:@"Daily"]) {
localNotif.repeatInterval = NSDayCalendarUnit;
}
localNotif.alertBody = @"Radio Asia Alarm";
localNotif.alertAction = @"Ok";
localNotif.soundName = UILocalNotificationDefaultSoundName;
NSDictionary *infoDict = [NSDictionary dictionaryWithObject:@"Radio Asia Alarm" forKey:@"Message"];
localNotif.userInfo = infoDict;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
[localNotif release];
}
而且我把這種方法,我點擊設置時間和日期
[self scheduleNotificationWithInterval:1];
我沒有得到警報後按鈕。我可以做什麼?
檢查datePicker.date字符串的日期格式 – Charan 2012-04-12 07:34:12
嘗試記錄firedate agter你設置它 – 2012-04-12 07:42:03