I'm trying to create a calendar with EKSourceTypeLocal
source. Iterate over the self.eventStore.sources
, find the one with sourceType == .Local
and attempt to create a new calendar with it.
self.calendar = EKCalendar(forEntityType: EKEntityType.Event, eventStore: self.eventStore)
self.calendar?.title = "My Awesome Calendar"
self.calendar?.source = src // src.sourceType == .Local
print("Created \(self.calendar!)")
do {
try self.eventStore.saveCalendar(self.calendar!, commit: true)
} catch let err as NSError {
print("Whoops: \(err)")
}
That executes without a problem, and allows me to add some events to that calendar as well. However, when I switch to the native Calendar app, this new one is no there, if I query self.eventStore.calendarsForEntityType(EKEntityType.Event)
after the above has completed, it's not there either, and if I restart the app, the calendar I created and all its events are nowhere to be found. What's happening?