Programmatically Link one CNContact to another, (swift iOS)

588 views Asked by At

I wants to link one contact to second contact programmatically...

I've linked it from phone, but could not find any code for it.

 var store = CNContactStore()

 let contact = try store.unifiedContact(withIdentifier: contactIdentifier, keysToFetch:keysToFetch as! [CNKeyDescriptor])
 let contactToUpdate = contact.mutableCopy() as! CNMutableContact

 /* edit or append contact information */

 let saveRequest = CNSaveRequest()
 saveRequest.update(contactToUpdate)
 try store.execute(saveRequest)

enter image description here

0

There are 0 answers