iosduplicatescontactsios-contacts

How to determine whether contacts in iOS are duplicates or not?


What criteria does Apple use to determine whether a vCard sent for example as an email attachment has a duplicate? I would think there has to be more in common between the duplicates than just the given name and the family name? Does Apple say whether the given name, family name, and address enough similarities to consider two contacts duplicates of each other?

I found code in answers on stackoverflow, but they appear to use the programmers' own criteria instead of Apple's criteria.


Solution

  • This is a conjectural answer, but still an answer! Just not entirely sure because I'm not at Apple's (and the question is not a question either), but the behavior I feel is that no matching is done. That being said. If you download a "Card" (I'll call it a Card to better match your lingo, but is a Contact). For the first time, iOS will not detect this as a duplicate. It will download normally. If I try to download again the same Card (let's say via WhatsApp), then it will detect the duplicate, for me is an id or most probably a UUID with a fixed seed using the Card's data.

    Another alternative is that the Card's data use some digest (md5?) and save the Card probably inside CoreData (sqlite) using this digest as ID. So when a "new" card comes in, the "duplication" is detected.

    This is for new Cards. But what about when Apple detects duplicates as a Warning for merge Cards?

    This, for me, is a background thread/queue that does the same digest, goes over the Card's data (couldn't ever know what fields, for me, it's all the fields) then store in another field "uniqueness" the digest, when this digest matches another digest already calculated the Contacts App warn the duplicate.

    Of course, this is all conjecture from my experience doing some Apps that use Contacts API. And this is a relatively new feature.

    Regards,