【问题标题】:Get events from iCal从 iCal 获取事件
【发布时间】:2015-07-13 15:06:48
【问题描述】:

我正在尝试从我在 iPhone 上使用 EventKit 订阅的日历中获取所有事件。

我只需要这个特定日历中的事件。

有可能得到它们吗?怎么样?

【问题讨论】:

标签: ios swift icalendar eventkit


【解决方案1】:
private func getAllEvents() {

    let store = EKEventStore()
    let cal = store.calendarWithIdentifier(yourCalenderIdentifier)
    let oneMonthAgo = NSDate(timeIntervalSinceNow: -30*24*3600)
    let oneMonthAfter = NSDate(timeIntervalSinceNow: +30*24*3600)

    let predicate = store.predicateForEventsWithStartDate(oneMonthAgo, endDate: oneMonthAfter, calendars: [cal!])

    let events = store.eventsMatchingPredicate(predicate)        
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-27
    • 1970-01-01
    • 2016-03-24
    • 2012-05-28
    • 1970-01-01
    • 2012-12-16
    相关资源
    最近更新 更多