我需要在我的应用程序中开发日历应用程序,因此我需要从 native 日历中获取事件来执行,在此之前我有一个疑问,我们如何知道 native 日历中有多少年?我们如何检索数据?
最佳答案
您可以使用 EKEventStore 类从用户的日历数据库中获取所有事件。
您可以从 eventstore
获取所有事件,只需将开始日期设置为 [NSDate distancePast]
并将结束日期设置为 [NSDate distanceFuture]
self.eventStore = [[EKEventStore alloc] init];
NSPredicate *fetchCalendarEvents = [self.eventStore predicateForEventsWithStartDate:[NSDate distantPast] endDate:[NSDate distantFuture] calendars:calendarArray];
NSArray *allEvents = [self.eventStore eventsMatchingPredicate:fetchCalendarEvents];
关于ios - 日历的实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18015569/