6
我想重复一个本地通知,每隔30分钟,但我的代码不能正常工作......我将不胜感激,如果你帮我找到解决办法,这里是我的代码:与按repeatInterval每30分钟有问题
UILocalNotification *reminderNote = [[UILocalNotification alloc]init];
reminderNote.fireDate = [NSDate dateWithTimeIntervalSinceNow:60 * 30];
reminderNote.repeatInterval = NSHourCalendarUnit;
reminderNote.alertBody = @"some text";
reminderNote.alertAction = @"View";
reminderNote.soundName = @"sound.aif";
[[UIApplication sharedApplication] scheduleLocalNotification:reminderNote];
谢谢大约每1小时或2或3我应该这样吗?例如每1小时:'reminderNote.fireDate = [NSDate dateWithTimeIntervalSinceNow:60 * 60]; reminderNote.repeatInterval = NSHourCalendarUnit;'和第二火日期'reminderNote.fireDate = [NSDate的dateWithTimeIntervalSinceNow:60 * 60];' – 2012-02-07 08:15:01
每1个小时,你只需要安排一个通知。只需在我的答案中的代码并摆脱最后两行。如有必要,更改'fireDate',以便它与您想要触发通知的第一次相对应。 – yuji 2012-02-07 09:21:34
大约每2小时或3次?这样对吗 ? :'reminderNote.fireDate = [NSDate dateWithTimeIntervalSinceNow:60 * 60 * 2]; [[UIApplication的sharedApplication] scheduleLocalNotification:reminderNote];' – 2012-02-07 17:43:46