简体   繁体   中英

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?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM