So currently, I have this EkEvent
:
EKEvent <0xb12dc30> {EKEvent <0xb12dc30> {title = Mitchell Smith’s Birthday; location = (null); calendar = EKCalendar <0x9a532c0> {title = Birthdays; type = Birthday; allowsModify = NO; color = #8295AF;}; alarms = (null); URL = (null); lastModified = (null); timeZone = (null)}; location = (null); startDate = 2013-08-13 07:00:00 +0000; endDate = 2013-08-14 06:59:59 +0000; allDay = 1; floating = 1; recurrence = EKRecurrenceRule <0xb2199e0> RRULE FREQ=YEARLY;INTERVAL=1; attendees = (null)}
I successfully parse to the EKCalendar
Key doing this :
NSLog(@"%@", [event valueForKey:@"calendar"]);
Which prints :
EKCalendar <0x9a532c0> {title = Birthdays; type = Birthday; allowsModify = NO; color = #8295AF;}
Then I attempt to get the EKCalendar
's Color attribute doing this:
NSLog(@"%@", [[event valueForKey:@"calendar"] valueForKeyPath:@"color"]);
Which prints:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<EKCalendar 0x9a532c0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key color.'
I am able to get the other attributes of EKCalendar
, but when I access the color
attribute, i get a crash EVERY time :(. So this class is not key value coding-compliant for the key color
is what I need to understand, anyone have any ideas on how to get this value?
My main goal is to get the color attribute, convert the "hex" number to an RBG
color then use quartz to display a small dot of the color. I am using this for a calendar application I am currently implementing.
There is a CGColor public property available on EKCalendar. You should be using this. Apple could change how their description method prints out at ant time, breaking your code.
UIColor *calendarColor = [UIColor colorWithCGColor:calendar.CGColor];