In my app I am trying to get all the events that happened during a specific time. This is the code I have:
let store = EKEventStore()
store.requestAccess(to: EKEntityType.event) { (granted, error) in
if(granted){
let calendars = store.calendars(for: EKEntityType.event)
for calendar in calendars {
let predicate = store.predicateForEvents(withStart: (dates.first?.dateObject)!, end: (dates.last?.dateObject)!, calendars: [calendar])
store.enumerateEvents(matching: predicate){ (event, stop) in
print(event.title)
}
}
}else{
print(error)
}
The problem with this is that it retrieve only birthdays, and dons't retrieve events created by the user or holidays in that day. Here is the output I get: Kate Bell’s Birthday Kate Bell’s Birthday Kate Bell’s Birthday Kate Bell’s Birthday John Appleseed’s Birthday John Appleseed’s Birthday John Appleseed’s Birthday John Appleseed’s Birthday Anna Haro’s Birthday Anna Haro’s Birthday Anna Haro’s Birthday Anna Haro’s Birthday David Taylor’s Birthday David Taylor’s Birthday David Taylor’s Birthday David Taylor’s Birthday
- So how could I make it work so I could get all events including the one made by the user on its calendar.
- And How could I retrieve the participants of each event?