Kwame
Kwame

Reputation: 1097

How to use NSDayCalendarUnit in iPhone app

I'm trying to setup a UILocalNotification object's repeatInterval attribute. It works well with NSDayCalendarUnit, but I need to set a repeat interval of every three days. I've tried NSDayCalendarUnit + 3, but that doesn't work. Any ideas?

UPDATE:
No, that is not working either. If I schedule

localNotify.repeatInterval = NSDayCalendarUnit 

the log shows:

<UIConcreteLocalNotification: 0x71aabf0>{fire date = 2010-07-16 02:40:00 -0400, time zone = US/Eastern (EDT) offset -14400 (Daylight), repeat interval = 16, next fire date = 2010-07-16 02:40:00 -0400}

If I schedule

localNotify.repeatInterval = NSDayCalendarUnit*3 

the log shows:

<UIConcreteLocalNotification: 0x71b4ae0>{fire date = 2010-07-16 02:30:00 -0400, time zone = US/Eastern (EDT) offset -14400 (Daylight), repeat interval = 48, next fire date = 2010-07-17 03:30:00 -0400}

So repeat interval goes forward by one hour on the following day, instead of what I want which is for it to repeat in 3 days time.
Any suggestions?

Upvotes: 0

Views: 1506

Answers (2)

Jonathan Grynspan
Jonathan Grynspan

Reputation: 43472

NSDayCalendarUnit is an enumeration constant; arithmetic has no sensible meaning in relation to it.

I do not believe the current local notifications API allows for the interval you want. You should file a bug report with Apple and request more fine-grained control of local notifications.

Upvotes: 1

Charter
Charter

Reputation: 783

I'd use NSDayCalendarUnit*3 to mean 3 days. Does it work ?

Upvotes: 0

Related Questions