Cannot access the properties of EKCalendar in iOS12.2 when using global queues.

This code do not access the EKCalendar property,

but it did not occur before updating iOS to 12.2 from 12.1.


let eventStore: EKEventStore = EKEventStore()
let myCalendar: EKCalendar? = eventStore.getCal(id: calendarId)
# print ("DEBUG 1: " + myCalendar!.title) 
DispatchQueue.global().async {
    DispatchQueue.main.async {
        print ("DEBUG 2: " + myCalendar!.title)
    }
}

Both DEBUG1 and DEBUG2 is empty.

Uncomment the line 03, both DEBUG1 and DEBUG2 display the calendar title.


Please tell me the cause and measures.


The getCal() function is added by myself as follows.

extension EKEventStore {
    func getCal(id: String) -> EKCalendar? {
        for cal in self.calendars(for: .event) {
            if cal.calendarIdentifier == id {
                return cal
            }
        }
        return nil
    }
}