我希望从所有日历(家庭,工作,日历和生日)获取活动。我从defaultcalendar获取事件,但无法从生日日历中获取事件。任何帮助都会很棒。
答案 0 :(得分: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]);
}