Add member to CNGroup cause CNDomainError 2

Hi everyone.
I have created an application that manages groups of contacts, some customers complain that they cannot insert the contacts in a group, and I have verified that this error is obtained:
"Updated Record Does Not Exists" e
"CNDomainError error 2"

I have looked for a possible cause but I have not found anything, this is the code that I run when I add a contact in a group:

Code Block
func addContactToGroup (group: CNGroup, contactIdentifier: String) throws {
let saveRequest = CNSaveRequest ()
let contact = (try? self.store.unifiedContact (withIdentifier: contactIdentifier, keysToFetch: kToFetch)) ?? nil
if contact! = nil {
saveRequest.addMember (contact !, to: group)
try store.execute (saveRequest)
}
}


The strange thing is that on most installations it works regularly.
Anyone know what it can depend on?
Add member to CNGroup cause CNDomainError 2
 
 
Q