EKEventStore.calendars返回不存在的“日历”对象

使用时获取IOS5上的所有日历

EKEventStore *eventStore = [[EKEventStore alloc] init]; NSArray * calendars = [eventStore calendars]; 

有一个名为“日历”的日历返回。 用户日历列表中不存在此日历。 它拥有这些属性:

 EKCalendar <0x357700> {title = Calendar; type = Local; allowsModify = YES; color = #882F00; 

用户可以在那里存储事件。 这些事件显示在IOS日历上。 有谁知道这是什么样的日历? 似乎是某种默认日历。 顺便说一句:用户日历都是基于CalDAV,所以这可能是这个对象的原因。

在代码中,您无法完全访问用户在其本机应用中使用的所有日历。

 "Event Kit provides limited access to a user's calendar information. It is not suitable for implementing a full-featured calendar application." 

如果你想编辑现有的事件,你将没有问题:

  "You can fetch events based on a date range or a unique identifier, receive notifications when event records change, and allow users to create and edit events for any of their calendars. Changes made to events in a user's Calendar database with Event Kit are automatically synced with the appropriate calendar (CalDAV, Exchange, and so on)." 

如果要添加新事件,则只能将其添加到日历中,该用户已select作为默认日历 (在设置应用程序中)。

  "Creating and Editing Events If the event property is nil when you present the view controller, the user creates a new event in the default calendar and saves it to the specified event store. If the event property is nil when you present the view controller, the user creates a new event in the default calendar and saves it to the specified event store." 

“ 事件工具包编程指南”中的所有引用。