Swift 与会者的问题,无法获取姓名、电子邮件等...我不断收到错误消息

Swift issue with Attendees, unable to get name, email, etc...I keep getting error message

我尝试获取日历,标题、颜色、start/end 日期等都没有问题...但我决定添加 "Invited" 但我一直收到错误消息:

For-in loop requires '[EKParticipant]?' to conform to 'Sequence'; did you mean to unwrap optional?

这是我的代码:

func create_currentevent_date() {
        let endtime = Calendar.current.date(bySettingHour: 23, minute: 59, second: 59, of: Date())!
        for get_category in date_calendar_category_user {
            for search_category in eventStore.calendars(for: EKEntityType.event) {
                if search_category.title == get_category {
                    for get_event in eventStore.events(matching: eventStore.predicateForEvents(withStart: Date(), end: endtime, calendars: [search_category])) {
                        let event_start = get_event.startDate.timeIntervalSince1970
                        let event_end = get_event.endDate.timeIntervalSince1970
                        let time_rightnow = Date().timeIntervalSince1970

                        for get_invite_detail in get_event.attendees { //THIS IS WHERE I GET ERROR MESSAGE

                        }

                        if time_rightnow >= event_start && time_rightnow <= event_end {
                            date_calendar_currentevent.append(calendar_getdetail(ce_title: get_event.title,
                                                                                 ce_category: get_event.calendar.title,
                                                                                 ce_color: get_event.calendar.cgColor,
                                                                                 ce_invited_name: "",
                                                                                 ce_invited_email: "",
                                                                                 ce_start: get_event.startDate,
                                                                                 ce_end: get_event.endDate))
                        }
                    }
                }
            }
        }
        for get_detal in date_calendar_currentevent {
            print("\(get_detal.ce_invited_name) and \(get_detal.ce_invited_email)")
        }
    }

我想从与会者那里获取 name/email(目前)到字符串中。我该怎么做?

谢谢

在循环之前展开可选的 get_event.attendees

if let attendees = get_event.attendees {
     for attendee in attendees {
       // do your code here
        print(attendee.name ?? "")
     }
    }

https://developer.apple.com/documentation/eventkit/ekparticipant