tags:

views:

57

answers:

3

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?

A: 

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

Charter
A: 

No, that is not working either. If I schedule

localNotify.repeatInterval = NSDayCalendarUnit the log shows:

{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:

{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?

Kwame
A: 

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.

Jonathan Grynspan
Thanks. I'll do that. In the meantime, do you know of any workaround for this?
Kwame
As I said, I don't think there's any way to. It's a limitation of the current `UILocalNotification` API. Sorry.
Jonathan Grynspan
I could probably figure something out if I knew a way to suppress a notification (but not cancel it altogether), that way I could schedule the repeatInterval with NSDayCalendarUnit, and just suppress notifications until a date I choose. So all I need now is a way to suppress UILocalNotification!
Kwame
You can cancel notifications from within your app, but since you can't execute code when your app is not running... yeah.
Jonathan Grynspan