我有两个问题。
,
这是代码
- (void) scheduleNotificationWithItem:(NSDate *)date interval:(int)frequency {
UILocalNotification *localNotif = [[UILocalNotification alloc]init];
if (localNotif == nil) {
return;
}
localNotif.fireDate = [date addTimeInterval:frequency];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.repeatCalendar = [NSCalendar currentCalendar];
localNotif.repeatInterval = kCFCalendarUnitWeekday;
localNotif.applicationIconBadgeNumber = 1;
localNotif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"%@.",nil),@"Weekly Reminder"];
localNotif.alertAction = NSLocalizedString(@"View Notification Details", nil);
localNotif.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication]scheduleLocalNotification:localNotif];
[localNotif release];
}拜托帮帮忙这让我快疯了。谢谢,迪恩
发布于 2011-11-14 19:48:50
1)将重复间隔设置为“NSWeekCalendarUnit”应该可以做到这一点。它每周在原始通知的同一天和时间重复。
2)我还没有在模拟器中进行测试,但更改实际iPhone上的时钟确实会触发未来的警报。
https://stackoverflow.com/questions/7355548
复制相似问题