简体   繁体   English

快速获取有关EKEvent的信息

[英]Getting information about EKEvent in swift

I'm having trouble getting the right Data from the Calender. 我无法从日历获得正确的数据。 I am able to access the Calender and get all events in a given time period. 我可以访问日历并获取给定时间段内的所有事件。 However I am not able to get the EKEvent Title. 但是,我无法获取EKEvent标题。 Is the Title Allway in the calendarItem? 日历项目中的标题是否始终存在? How can i access it if i have the EKEevent? 如果我有EKEevent,该如何访问?

let eventStore = EventStore.sharedInstance.eventStore
        for et in eventStore.calendarsForEntityType(EKEntityTypeEvent) {
            println(et)
        }

        let cals = eventStore.calendarsForEntityType(EKEntityTypeEvent)

        //today
        let today = NSDate()
        //yesterday
        let yesterday = NSDate()
        let last = yesterday.dateByAddingTimeInterval(-3259487.66)

        let fetchCalendarEvent =   
eventStore.predicateForEventsWithStartDate(last, endDate: today, calendars: 
cals)

        let eventlist = eventStore.eventsMatchingPredicate(fetchCalendarEvent)

        for test in eventlist{
            println(test)
        }

Just found the answer. 刚找到答案。 println(eventStore.calendarItemWithIdentifier(mob.calendarItemIdentifier).title) gives me the desired value println(eventStore.calendarItemWithIdentifier(mob.calendarItemIdentifier).title)给了我想要的值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM