I am fetching the Events from the calendar and for each event i want to fetch all the data. But i am getting some of them as objects like EKRecurrenceRule, EkCalendar, EKAlarm. Now i want to get a particular field from the object. I tried converting the object into a Dictionary object but it goes as a single object and when i access it it returns a single value with the entire object. Can anybody help me converting them directly into dictionary.
Asked
Active
Viewed 496 times
0
-
1You can't convert an `EKCalendar`, for example, into an `NSDictionary` because it isn't one. All of the values that you can get at are properties of the object; just fetch them with dot-notation or a method call. – rsswtmr Mar 13 '13 at 12:34
-
what about EKRecurrence ? It returns me an array, and still i am not able to access it. It gives me a null value when i access it like this , NSArray *arr = [NSArray arrayWithArray:e.recurrenceRules]; NSDictionary *dict = [NSDictionary dictionaryWithObject:arr forKey:@"dict"]; NSLog(@"Interval : %@",[dict valueForKey:@"INTERVAL"]); – Abhishek Shah Mar 13 '13 at 12:44
-
You don't need a dictionary to just access object's properties. Read description of EKEvent class to see what properties are available. – Jeepston Mar 13 '13 at 12:49
-
Yes, i saw the class reference and everything. The problem is i am backing up my events data from iPhone and pushing onto the server, and i want to catch this data at the android side. So i cannot pass the data directly cause it is not recognised at android side. Also i dont have to use any 3rd party servers like google for syncing. So i want to separate out the data. I am getting recurrence rules as an array and i am asking how can i access values from it seperately to store it individually. – Abhishek Shah Mar 13 '13 at 13:03
-
in that case - create NSDictionary manually and copy all needed properties – Jeepston Mar 13 '13 at 14:03
1 Answers
0
use KVC for that... valueForKey
and valueForKeyPath
allow you treat the object 'kind of like a dictionary'

Rishil Patel
- 1,977
- 3
- 14
- 30

Daij-Djan
- 49,552
- 17
- 113
- 135
-
i tried doing it ... and for the first instance i am getting the entire object EKRecurrenceRule <0x18b0f0> RRULE FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR That means it did not get seperated when i pushed it into a dictionary object.. – Abhishek Shah Mar 13 '13 at 13:05
-
-