CNSaveRequest.addMember(_:to:) CNContactStore.execute(_:) The operation couldn’t be completed. (CNErrorDomain error 2.)

I am getting an error adding a contact to a group. I wonder if there are restrictions I am overlooking. Does the contact have to be in the container that the group belongs to? Can the contact be a member of more than one group or more than one container?


How do I figure out what the error means? The documentation for CNErrorDomain doesn't give any details. Isn't there a resource that tells me what error 2 means for CNErrorDomain?


Here is my code:


    let saveRequest = CNSaveRequest()
   
    saveRequest.addMember(contact, from: utiGroup.cnGroup)
   
    do {
       
        try contactStore.execute(saveRequest)
       
    } catch {
       
        print("!!!!! Warning\n", error.localizedDescription)


    }


Here is the output in the debug window:


!!!!! Warning

The operation couldn’t be completed. (CNErrorDomain error 2.)