2012-07-12 59 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