2

When i try to add cncontact using saveRequest the identifier which I get from CNMutableContact is different from fetched contacts.

To fetch all contacts

for container in allContainers {
let fetchPredicate = CNContact.predicateForContactsInContainer(withIdentifier: (container.identifier))

do {
    let containerResults = try self.contactStore.unifiedContacts(matching: fetchPredicate, keysToFetch: self.keysToFetch as [CNKeyDescriptor])
    results.append(contentsOf: containerResults)
} catch {
    print("Error fetching results for container")
}

Add contact to native

request.add(contact, toContainerWithIdentifier: nil)
try self.contactStore.execute(request)

I referred this link What is the ":ABPerson" string in CNContact identifier? but no luck

Note: Account syncing is enabled

Any suggestions for getting similar contact identifier?

Priyanka M V
  • 111
  • 3

0 Answers0