Duck
Duck

Reputation: 36013

iPhone UILocalNotification values

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

Upvotes: 0

Views: 788

Answers (2)

Duck
Duck

Reputation: 36013

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.

Upvotes: 0

Rahul Juyal
Rahul Juyal

Reputation: 2144

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.

Upvotes: 1

Related Questions