Access events in the Email Events calendar

I am trying to access events that are automatically generated from email using the new proactive assistant feature found in iOS 9. Events are displayed in the "Events found in Mail" calendar.

To access these, I do the following

self.eventStore.requestAccessToEntityType(.Event, completion: { (granted, error) -> Void in let predicate = eventStore.predicateForEventsWithStartDate(NSDate(timeIntervalSince1970: timestamp1), endDate: NSDate(timeIntervalSince1970: timestamp2), calendars: nil) let events = eventStore.eventsMatchingPredicate(predicate) } 

However, events on this calendar are not indicated. Is this a restriction from Apple, or can I access them in any other way?

enter image description here

+8
ios objective-c iphone swift eventkit
source share
2 answers

I was able to ask the apple engineers this question, and their answer is that they do not open this calendar for privacy reasons. They want the user to add an event handled from the mail to one of their regular calendars to confirm that they want to expose it in other applications, and therefore this calendar is not displayed during normal

  let calendars = store.calendarsForEntityType(EKEntityTypeEvent) 
+2
source share

I'm not sure if this is a limitation for Apple, but overall, if you know the name of the calendar, you can access it like that :)

 func yourFunc(store: EKEventStore) { let calendars = store.calendarsForEntityType(EKEntityTypeEvent) as! [EKCalendar] for calendar in calendars { if calendar.title == "Events Found in Mail" { //Do something!}}} 

Try something in this direction!

0
source share

All Articles