嘿,伙计们,我刚接触过“迅捷和事件工具包”,我有这行代码,我可以从它打印事件而不是日历名称吗?
var eventStore = EKEventStore()
eventStore.requestAccessToEntityType(EKEntityTypeEvent,
completion: {(granted: Bool, error:NSError!) in
if !granted {
println("Access to store not granted")
}
})
let events = eventStore.calendarsForEntityType(EKEntityTypeEvent)
for events in events as [EKCalendar] {
println("events = \(events.title)")
}发布于 2015-03-21 21:27:10
我知道从EKEventStore获取事件有两种方法,但是它们都需要谓词,通常使用开始/结束日期和日历数组来检查。
let predicate = store.predicateForEventsWithStartDate(startDate, endDate: endDate, calendars: nil) // nil calendar checks all calendars, otherwise pass [EKCalendar]使用:
let events = store.eventsMatchingPredicate(predicate) as [EKEvent]或者:
store.enumerateEventsMatchingPredicate(predicate) { event, stop in
}https://stackoverflow.com/questions/29186703
复制相似问题