5

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

Salome Tsiramua
  • 763
  • 3
  • 9
  • 21
  • 1
    Possible duplicate of [Programmatically Link CNContacts](http://stackoverflow.com/questions/30944065/programmatically-link-cncontacts) – Palpatim Dec 21 '16 at 15:45

0 Answers0