0

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

4

1 回答 1

0

This answer might help you:

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]);

}
于 2013-09-03T14:20:04.390 回答