4

I'm working on a iPhone contacts management app. A user reported that all of his contacts were duplicated. When he selects a specific source the contacts are not duplicated though. Apparently this is because his addressbook is synced twice: with iTunes on his PC, and with Exchange over the air.

Do you guys have any idea of how I could get rid of the duplicates? I don't think that the recordIDs are the same, and filtering by name doesn't look like a good idea :)

Thanks!

saintmac
  • 590
  • 4
  • 15
  • A detailed explanation can be found here: http://stackoverflow.com/questions/4067542/getting-merged-unified-entries-from-abaddressbook/10062972#10062972 – Min Tsai Sep 04 '12 at 04:45

1 Answers1

3

Check out ABPersonCopyArrayOfAllLinkedPeople - it'll give you the records that were merged together.

SVD
  • 4,743
  • 2
  • 26
  • 38
  • Thanks! So the Idea would be to get an array of all the (potentially duplicated contacts) with ABAddressBookCopyArrayOfAllPeople, and then to iterate through this array using ABPersonCopyArrayOfAllLinkedPeople to check for duplicates? And how to pick the best contact (the one that apple Contacts app would show)? Thanks again – saintmac Jul 08 '11 at 20:37
  • Note that all linked records will look alike (i.e. each of the linked records will return all others in ABPersonCopyArrayOfAllLinkedPeople). As far as I remember it automatically links only records with identical info (like same record cross-synced from two sources), so it probably doesn't matter which one to show. – SVD Jul 08 '11 at 21:19
  • 1
    the linked contacts can have different information. just picking one randomly is not a good idea. – pre Jun 28 '12 at 21:39