23

Is there any way in iOS to get notification about address book changes since the last time applications was opened.

The application stores address book in internal database and I don't want to perform full sync each time it activated.

Thanks in advance.

Small addition to clarify the question: I use ABAddressBookRegisterExternalChangeCallback to observe changes when application suspended to background, but from what I know, this method can't work if application was closed completely and reopened(for example: after phone restart or closed from task list).

tipycalFlow
  • 7,594
  • 4
  • 34
  • 45
Ilya K.
  • 940
  • 6
  • 16

1 Answers1

3

Maybe you're looking for this:

ABAddressBook Reference - ABAddressBookRegisterExternalChangeCallback

You should register that notification!

Tell me if worked or if you need any help

Mário

Mário Carvalho
  • 3,106
  • 4
  • 22
  • 26
  • This will work only while application is running(or suspended in bg) and registered to this callback. I want to get notification even if application was closed completely. – Ilya K. Sep 10 '12 at 10:11
  • I was searching for a creation date but I think that doesn't exist. In my opinion the best solution is to revert your data each time that the user starts the app and register a notification if the Address Book was changed while the app is running. More info here: http://developer.apple.com/library/ios/#DOCUMENTATION/AddressBook/Reference/ABAddressBookRef_iPhoneOS/Reference/reference.html#//apple_ref/doc/uid/TP40007099 – Mário Carvalho Sep 10 '12 at 10:18
  • Yeap, I looked for it too, but thought maybe I missed something. Full sync could be painful if iPhone contains 10k addressbook entries. – Ilya K. Sep 10 '12 at 10:23
  • 2
    I will save the last sync time.and when open my app,I will check the sync time and the record last modified time ,so I will know after my last sync,which record has been modified. hope this help. – frank Apr 15 '14 at 09:01
  • But, how can i get last modified time of each record in faster way ? I am stuck with samething http://stackoverflow.com/questions/31759863/how-whatsapp-get-updated-contacts-from-addressbook-faster-in-ios – Mrug Aug 01 '15 at 10:13