2012-07-12 63 views
0

我的应用程序是一个药物提醒,许多客户要求我实施可能性,每天安排一种药物,永远。如何永久设置通知?

我知道应用程序可以设置的本地通知数量有限,那么设置此类提醒的好方法是什么?

回答

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

所以,你可能想,如果你需要其他的重复间隔来看看:这常量定义。

+0

这将设置一个通知,并重复每一天? – Aleph72 2012-07-12 08:04:32

+0

那就对了,notification.repeatInterval = NSDayCalendarUnit;线。 – tomidelucca 2012-07-12 08:07:14

+0

这就是我正在寻找的。非常感谢你! – Aleph72 2012-07-12 08:08:36