I\'m having an issue where I create my EKCalendar and everything looks good but then when I go to list my calendars, it doesn\'t show up. I also go to check my calendar list
The local store may not support events. This is reproducible if iCloud is enabled.
This is the most reliable solution I could find, without hard-coding any assumptions:
let calendar = EKCalendar(forEntityType: .Event, eventStore: eventStore)
if eventStore.sources.count == 0 { // reproducible after Reset Content and Settings
calendar.source = EKSource()
}
else {
calendar.source = eventStore.defaultCalendarForNewEvents.source
}
eventStore.saveCalendar(calendar, commit: true)