EKCADErrorDomain using calendarWithIdentifier

前端 未结 2 1823
自闭症患者
自闭症患者 2020-12-30 07:16

In my iOS app i used to access calendar with the following method:

EKCalendar* cal = [eventStore calendarWithIdentifier:[calendarIDs objectAtIndex:i]];
         


        
2条回答
  •  甜味超标
    2020-12-30 07:45

    Swift 4.2

    Instead of

    let matchedCal = eventStore
        .calendar(withIdentifier: calendarIdentifier)
    

    You can use:

    let matchedCal = eventStore
        .calendars(for: .event)
        .first(where: { $0.calendarIdentifier == calendarIdentifier })
    

提交回复
热议问题