Good Day to you. I have used iCal events in my app. I have add events to iCal and retrieve/delete the events from iCal from my sample iPhone app. Now, i want to show all the calendars what are the calendars user synced in their iPhone(Eg : Google calendar). Then i want to retrieve the events from other calendars except iCal. How can i get all the synced calendars from iPhone? I searched my level best in Google but, can't to get right answer. Can you please help me? Thanks in advance.
I thank you all for viewing my question. I got the solution for my question. I just retrieved the calendars from EKEventStore
and used EKCalendar
. Here is my code,
EKEventStore *eventStore = [[[EKEventStore alloc] init] autorelease];
EKEvent *events = [EKEvent eventWithEventStore:eventStore];
NSArray *caleandarsArray = [[NSArray alloc] init];
caleandarsArray = [[eventStore calendars] retain];
for (EKCalendar *iCalendars in caleandarsArray)
{
NSLog(@"Calendar Title : %@", iCalendars.title);
}
This code working for me. Thanks.
The above code is allocating a new array and pointing the reference to a different array. Isn't this a memory leak?
NSArray *caleandarsArray = [[NSArray alloc] init];
caleandarsArray = [[eventStore caleandarsArray] retain];
This is more optimal.
NSArray *caleandarsArray = [[eventStore caleandarsArray] retain];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With