Skip to content

Instantly share code, notes, and snippets.

@ShivaHuang
Created August 18, 2013 08:29
Show Gist options
  • Select an option

  • Save ShivaHuang/6260569 to your computer and use it in GitHub Desktop.

Select an option

Save ShivaHuang/6260569 to your computer and use it in GitHub Desktop.
ABRecordRef ABRecordCreateCopy (ABRecordRef record)
{
ABRecordRef people[1] = {record};
CFArrayRef peopleArray = CFArrayCreate(NULL, people, 1, &kCFTypeArrayCallBacks);
CFDataRef vCardData = ABPersonCreateVCardRepresentationWithPeople(peopleArray);
ABRecordRef source = ABPersonCopySource(record);
ABRecordRef duplicatedPerson = ABPersonCreatePeopleInSourceWithVCardRepresentation(source, vCardData);
ABRecordRef returnedPerson = CFArrayGetValueAtIndex(duplicatedPerson, 0);
CFRelease(source);
CFRelease(vCardData);
CFRelease(duplicatedPerson);
return CFRetain(returnedPerson);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment