每周本地通知

我有一个小问题,我怎么可以做每周本地通知。 我的应用程序是一个时间表,当用户在8点有一个class级,然后当用户打开开关时,有一个切换,这意味着他有一个通知在7:45每周留在他的同一时间。 我希望你能理解我。

您可以使用NSWeekCalendarUnit repeatInterval

 UILocalNotification *localNotification = [[UILocalNotification alloc] init]; localNotification.repeatInterval = NSWeekCalendarUnit; localNotification.fireDate = yourDateandTime; localNotification.alertBody = [NSString stringWithFormat:@"Alert Fired aton every week at 7:45Am"]; localNotification.soundName = UILocalNotificationDefaultSoundName; localNotification.applicationIconBadgeNumber = 1; [[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; 

它会每周重复同一时间。你可以参考和下载本教程的例子