Alterplay/APAddressBook

how to get notified on changes in phone book

techwizardg opened this issue · 4 comments

This is not a bug but do not know where to post.

We are using this library to manage iPhone contacts in our app. WE have a requirement where any change in native phone book our app need to be notified.when the app is in background and changes are done in native phone book and when the app comes to foreground,

This method is not getting called when app is in foreground/background
[addressBook startObserveChangesWithCallback:^
{
// reload contacts
}];

This is not getting called.

Every time a change is done in native phone book we are storing the time and every time we do not want to reload contacts but want to query contacts which created/modified time is greater than stored time

Is that possible

  1. Try example in this repo. It uses startObserveChangesWithCallback: and it should be called when app returns to foreground. Of course, there are no callback if app was terminated in background
  2. You can add filter for contacts that have creation/modification date greater then stored one. But what if contact was removed? It's unable to find removed contacts. So, I think it's better to reload all contacts.

Ok, then you should check Filter contacts in readme. And don't forget to include APContactFieldRecordDate to fieldMask property.