2015-04-04 28 views
0

我無法從日曆獲取正確的數據。我可以訪問日曆並獲得特定時間段內的所有活動。但是我無法獲得EKEvent標題。 calendarItem中的標題是否全是?我如何訪問它,如果我有EKEevent?在swift中獲取有關EKEvent的信息

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) 
     } 

回答

0

剛剛找到答案。 println(eventStore.calendarItemWithIdentifier(mob.calendarItemIdentifier).title)給了我想要的值