0

I am creating several UILocalNotifications with different repeatIntervals.

All repeat intervals are assigned using a NSCalendarUnit, like

myNotification.repeatInterval = NSWeekdayCalendarUnit;

I am debugging. When I print the NSArray containing the notifications using

NSArray*  oldNotifications = [app scheduledLocalNotifications];
NSLog(@"alarms = %@", oldNotifications);

I see the notification printed as this:

"{fire date = 2011-09-19 06:26:00 +0000, time zone = Europe/Lisbon (WEST) offset 3600 (Daylight), repeat interval = 512, next fire date = 2011-09-19 06:26:00 +0000}"

Notice that the repeat interval is a number, in this example 512, but it can be 256, 0, whatever.

Where do I find the equivalence of these numbers withe the NSCalendarUnit? I need to know what they are, so I can debug. "Jump to definition" on Xcode does not shows the numbers.

thanks

Duck
  • 34,902
  • 47
  • 248
  • 470

2 Answers2

1
if we use NSWeekCalendarUnit then we get this.
fire date = 2011-09-17 09:05:00 +0000, time zone = Asia/Kolkata (GMT+05:30) offset 19800, repeat interval = 256, next fire date = 2011-09-17 09:05:00 +0000

if we use NSWeekdayCalendarUnit then we get this.

fire date = 2011-09-17 09:05:00 +0000, time zone = Asia/Kolkata (GMT+05:30) offset 19800, repeat interval = 512, next fire date = 2011-09-17 09:05:00 +0000

these are pre defind interval by ios we cant change it.
Rahul Juyal
  • 2,124
  • 1
  • 16
  • 33
0

Duh! I realized I could simple print the values like this:

NSLog(@"NSEraCalendarUnit = %d", NSEraCalendarUnit);
NSLog(@"NSYearCalendarUnit = %d", NSYearCalendarUnit);
NSLog(@"NSMonthCalendarUnit = %d", NSMonthCalendarUnit);
NSLog(@"NSDayCalendarUnit = %d", NSDayCalendarUnit);
NSLog(@"NSHourCalendarUnit = %d", NSHourCalendarUnit);
NSLog(@"NSMinuteCalendarUnit = %d", NSMinuteCalendarUnit);
NSLog(@"NSSecondCalendarUnit = %d", NSSecondCalendarUnit);
NSLog(@"NSWeekCalendarUnit = %d", NSWeekCalendarUnit);
NSLog(@"NSWeekdayCalendarUnit = %d", NSWeekdayCalendarUnit);

... etc

to know the equivalence in integers.

Duck
  • 34,902
  • 47
  • 248
  • 470
  • ...or look at the [reference](http://developer.apple.com/library/ios/documentation/CoreFoundation/Reference/CFCalendarRef/Reference/reference.html#//apple_ref/doc/uid/TP40001434-CH1g-C007681). – albertamg Sep 17 '11 at 09:22
  • the references do not gives the integer values. – Duck Sep 17 '11 at 11:29
  • An excerpt from the reference: `kCFCalendarUnitWeekday = (1 << 9)` – albertamg Sep 17 '11 at 12:50
  • this is klingon to me. If you can tell me how this can be translated in an integer, I appreciate. – Duck Sep 22 '11 at 23:23
  • 2
    `<<` is the left shift operator. It takes the binary representation of a value, and moves all the bits n places to the left, back-filling with zeros. – albertamg Sep 23 '11 at 08:56