Weekly local notification

99封情书 提交于 2019-12-24 06:38:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!