add EKAttendee on EKEvent, but happen crash issue on iOS16.4

on iOS16.4, if try to add EKAttendee on EKEvent, it will cause app crash; this can not reproduce on iOS14.5/iOS15.7 etc low version.

Add Main example Attendee code: Class className = NSClassFromString(@"EKAttendee"); NSMutableArray *attendeessystem = [NSMutableArray new];

    for(int i=0; I<1;i++){

        id attendee = [className new];

       [attendee setValue:@"test" forKey:@"firstName"];
       [attendee setValue:@"hihi" forKey:@"lastName"];
       [attendee setValue:@"test@outlook.com" forKey:@"emailAddress"];
       [attendeessystem addObject:attendee];
    }

    if([attendeessystem count]>0)
    {
        [calendarEvent setValue:attendeessystem forKey:@"attendees"];
    }

crash log: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKeyedSubscript:]: key cannot be nil'

*** First throw call stack:

Replies

EventKit doesn't have public api to add attendees to events. Therefore, bad things like crashes can happen if you try to do this through other methods. If you'd like additional API, please file a feedback assistant request with your proposed feature.

https://stackoverflow.com/questions/56208959/how-to-add-the-uuid-to-an-ekattendee-object

Added the UUID it not crashed

attendee.setValue(UUID().uuidString, forKey: "UUID")