每周本地通知 [英] Weekly local notification
本文介绍了每周本地通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个小问题,我怎么做每周一次的本地通知.我的应用程序是关于用户在 8 点上课时的时间表,然后当用户打开开关时有一个开关,这意味着他在 7:45 有一个通知,让他每周都在同一时间保持不变.我希望你理解我.
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 .
推荐答案
你可以使用 repeatInterval
和 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
这篇关于每周本地通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文