How can I get the entire calendar and its events from the iphone application?

Good day to you. I used iCal events in my application. I add events to iCal and retrieve / delete events from iCal from my iPhone application example. Now I want to show all the calendars, what are the custom calendars synchronized on their iPhone (for example: Google calendar). Then I want to get events from calendars other than iCal. How can I get all synced calendars from iPhone? I was looking for my best level on Google, but can't get the right answer. could you help me? Thanks in advance.

+6
source share
2 answers

I thank you all for watching my question. I got a solution on my question. I just got 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 works for me. Thank you

+8
source

The above code allocates a new array and points to a reference to another array. Isn't that a memory leak?

 NSArray *caleandarsArray = [[NSArray alloc] init]; caleandarsArray = [[eventStore caleandarsArray] retain]; 

This is more optimal.

 NSArray *caleandarsArray = [[eventStore caleandarsArray] retain]; 
+4
source

Source: https://habr.com/ru/post/906178/


All Articles