views:

485

answers:

2

In the iPhone OS4 SDK, does anyone have a suggestion for how I would implement a repeating local notification that ends on a particular date?

Looking at the API documentation, there doesn't appear to be a built-in property of UILocalNotification to allow you to set an end date on a repeat.

Any suggestions would be much appreciated.

Thank you!

A: 

Two ways that you could go about it:

Track the end date in your app. Whenever the app launches, check for notifications which are now "expired" and call cancelLocalNotification on them.

Alternatively, instead of using the repeatInterval property of the notification, manually schedule the x number of repeat notifications.

Chris
+1  A: 

Set notification for each repeat date and check programatically that repeat date is not greater than end date by NSDateComparator.

Apoorv