0

我的应用程序是一个药物提醒,许多客户要求我实现每天安排药物的可能性,永远。

我知道一个App可以设置的本地通知的数量是有限的,那么设置这种提醒的好方法是什么?

4

1 回答 1

1

通知后UILocalNotification *notification = [[UILocalNotification alloc]init];,您需要设置repeatInterval通知的属性。

所以:

UILocalNotification *notification = [[UILocalNotification alloc]init];

...

notification.repeatInterval = NSDayCalendarUnit;

...

[[UIApplication sharedApplication] scheduleLocalNotification:notification];

注意:随着NSDayCalendarUnit通知将每天重复。如果你愿意,你可以使用其他常量让它每周重复一次或其他什么。此常量定义在:

http://developer.apple.com/library/ios/#DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSCalendar_Class/Reference/NSCalendar.html#//apple_ref/doc/c_ref/NSCalendarUnit

因此,如果您需要其他重复间隔,您可能想看看。

于 2012-07-12T07:59:39.800 回答