0

I followed this link to create an EKAttendee object with a contact email. But when I create the event with an attendee, the UUID of the attendee is null and the attendee can't be seen in iCal.

So how can I add the UUID to my EKAtttendee object? I tried with the following code:

func createParticipant(email: String, firstName: String, familyName: String, emailIdentifier: String) -> EKParticipant? {
    let clazz: AnyClass? = NSClassFromString("EKAttendee")

    if let type = clazz as? NSObject.Type {
        let attendee = type.init()
        attendee.setValue(emailIdentifier, forKey: "identifier")
        attendee.setValue(email, forKey: "emailAddress")
        attendee.setValue(firstName, forKey: "firstName")
        //attendee.setValue(familyName, forKey: "familyName")
        return attendee as? EKParticipant
    }
    return nil
}

But the result is:

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<EKAttendee 0x282db7040> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key identifier.

rmaddy
  • 307,833
  • 40
  • 508
  • 550

0 Answers0