问题
I have a small question how could I do a weekly local notification. My app is about a time table when the user has a class on 8 o'clock then there is a switch when user tern the switch on that mean he has a notification on 7:45 to remained him every week on the same time . I hope u understood me .
回答1:
You can use repeatInterval
with NSWeekCalendarUnit
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];
It will repeat every week on same time.You can refer and download example from this tutorial
来源:https://stackoverflow.com/questions/24874160/weekly-local-notification