CNContact identifiers

Hi,

I saw the WWDC talk on the new Contacts framework, and I had a couple of questions about the identifier property:


  1. When users upgrade from iOS8 to iOS9, will their old AddressBook recordIDs still work if we are using the AddressBook framework in the app (i.e. haven't upgraded to using Contacts framework)?
  2. Are the new CNContact identifiers consistent across iOS and Mac devices? i.e. if we have the identifier on one device, we can lookup the contact on another device with the same identifier?
  3. Can these identifiers change in the lifetime of that contact? This was a problem with AddressBook recordIDs ... if you removed the account and then synced it back again, all the contacts would get a different identifier. Same with restoring the device.
  4. Will the CNGroup and CNContainer identifiers also be consistent across devices?


Hope someone in the Apple Contacts frameworks team can answer.

Thanks.

Replies

Hi,

i already tryed to migrate my code to use contact framework but i simply can't, the problem is that there's no way to found ,in the CNContact , the legacy identifier (get using "ABRecordGetRecordID" in the ABAddressBook framework), there's a new identifier.


i create a bug report for this #22895795

I have simular questions.

So I was doing some testing with this because I really need the identifiers to be consistent between iOS and OS X.


I'm storing the CNContact identifer in my database to use as a lookup to get the full contact details.


Selecting one specific contact on OS X I get the following CNContact identifer:


AB03A064-72F4-4516-B2EB-17D269FB38D9:ABPerson


If I select the same contact on iOS, I get this identifier:


35631917-6FB2-43FC-ABA3-9B0E32365CC5


So it seems to me that they're different and no way to know that they're the same contact.


How on Earth does Apple do it to make sure that when a contact is synced between devices that it's the same contact?


Do I really have to just search by the person's name to find the right CNContact object?

So from the docs on CNContact:


It is recommended that you use the

identifier
when re-fetching the contact. An identifier can be persisted between the app launches. Note that this identifier only uniquely identifies the contact on the current device.

I have the same question, someone help us? I am failing to update a contact because of 2 differenct identifiers.

Still, years later, this is not working as the 'docs' would suggest. Not only is the ID not unique across devices, it's not even unique across Apps on the same device. i.e. If I 'share' a CNContact, from the Contacts App, I get an identifier with :ABPerson suffix (***!) but link to THE SAME CNCONTACT from using the CNContactPickerVC it has a DIFFERENT indentifier WITHOUT the spurios :ABPerson suffix.

Come on Apple! How are we supposed to use such a painful API?