2013-02-12 25 views
0

我想从所有日历(家庭,工作,日历和生日)获取活动。我从defaultcalendar获取事件,但无法从生日日历中获取事件。任何帮助都会很棒。从所有EKCalendar获取活动

回答

0

This answer可以帮助你:

NSDate* endDate = [NSDate dateWithTimeIntervalSinceNow:[[NSDate distantFuture] timeIntervalSinceReferenceDate]]; 
NSArray *calendarArray = [NSArray arrayWithObject:cal]; 
NSPredicate *fetchCalendarEvents = [eventStore predicateForEventsWithStartDate:[NSDate date] endDate:endDate calendars:calendarArray]; 
NSArray *eventList = [eventStore eventsMatchingPredicate:fetchCalendarEvents]; 

for(int i=0; i < eventList.count; i++){ 

    NSLog(@"Event Title:%@", [[eventList objectAtIndex:i] title]); 

}