What is the "too many connections to calaccessd" error and how do I avoid it?

Recently in Xcode 11 / iOS 13 Beta 5 I'm getting this error about calaccessd, which also results in EventKit basically stopping to work (can't query stores and can't create new reminders). Can someone shed some light on what this is and how we are supposed to avoid it? I haven't found any documentation on what this means.


2019-08-03 16:04:02.074255-0500 Grocery[12560:472695] [EventKit] Client tried to open too many connections to calaccessd. Refusing to open another

2019-08-03 16:04:02.075008-0500 Grocery[12560:472695] [EventKit] Error (1021) in reply block for CADDatabaseFetchCalendarItemsWithPredicate attempt 1/3

2019-08-03 16:04:02.075318-0500 Grocery[12560:472695] [EventKit] Error (1021) in reply block for CADDatabaseFetchCalendarItemsWithPredicate attempt 2/3

2019-08-03 16:04:02.075554-0500 Grocery[12560:472695] [EventKit] Error (1021) in reply block for CADDatabaseFetchCalendarItemsWithPredicate attempt 3/3

2019-08-03 16:04:02.075725-0500 Grocery[12560:472695] [EventKit] All retries exhausted for CADDatabaseFetchCalendarItemsWithPredicate

2019-08-03 16:04:19.347519-0500 Grocery[12560:470859] [EventKit] Client tried to open too many connections to calaccessd. Refusing to open another

2019-08-03 16:05:41.960457-0500 Grocery[12560:470859] [EventKit] Error getting default calendar for new reminders: Error Domain=EKCADErrorDomain Code=1021 "(null)"

2019-08-03 16:05:41.960603-0500 Grocery[12560:470859] [EventKit] No object ID provided. Will not find out if the object exists.

2019-08-03 16:06:37.449743-0500 Grocery[12560:470859] [EventKit] Client tried to open too many connections to calaccessd. Refusing to open another

2019-08-03 16:07:30.978900-0500 Grocery[12560:470859] [EventKit] Client tried to open too many connections to calaccessd. Refusing to open another

Replies

f you call doSomethingWithCals (see example below) to much you will get the error.


Instead place this at the top of the class:

let eventStore7: EKEventStore = EKEventStore()

var calendars7: [EKCalendar] = []


and in the ViewDidLoad place and then use calendars7 as needed


override func viewDidLoad() {

super.viewDidLoad()

calendars7 = eventStore7.calendars(for: EKEntityType.event)

}


func doSomethingWithCals {

let eventStore7: EKEventStore = EKEventStore()

var calendars7: [EKCalendar] = []

}