13

Questions:

  1. How to get the last modified date in CNContact (new apple contacts framework) ?
    The last modified date is not present in the list of keysToFetch

  2. I would like to fetch and update contacts that have been modified since my last fetch. How can I do this ?

user1046037
  • 16,755
  • 12
  • 92
  • 138

3 Answers3

5

According to the Apple Staff reply, no api for that right now. https://forums.developer.apple.com/thread/16049

To perform nearly the same thing, I would suggest using

enumerateContactsWithFetchRequest:error:usingBlock:

Assuming an individual contact is identified by name, when the name field remain the same but other infos are changed, we can say the contact is updated. If you concern about the performance, do it on a background queue.

Hope this help.

MatthewLuiHK
  • 691
  • 4
  • 10
  • 2
    You'd actually want to identify the contact by the identifier, not by the name... contact names can change and everything. – user435779 Dec 04 '15 at 14:49
  • So I use "Assuming", when none of a user's info field can be promised will eternally remain the same. Use which field (or fields) to identify a user is your decision to make according to you system's requirement. – MatthewLuiHK Dec 04 '15 at 15:23
0

I have checked out CNContact framework for iOS 12, but I can't find API like kABPersonModificationDateProperty

https://developer.apple.com/documentation/contacts/cncontact?language=objc

dobiho
  • 1,025
  • 1
  • 11
  • 22
0

CNContact has a field called identifier

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.

Refer: https://developer.apple.com/documentation/contacts/cncontact/1403103-identifier

user1046037
  • 16,755
  • 12
  • 92
  • 138