Question: Hey,  

I'm saving a copy of all contacts in a database.  

Upon launching, I want to check if there is a new contact in the address book in order to add it to my data base. 

How to perform this check? I can't find the suitable logic to implement it.

Answer: 
There's not an easy way to get "new contacts" in the address book. Instead you'll have to do something like this:

1. [Get an array of all the contacts in the address book](http://developer.apple.com/library/ios/documentation/AddressBook/Reference/ABPersonRef_iPhoneOS/Reference/reference.html#//apple_ref/c/func/ABAddressBookCopyArrayOfAllPeople).
2. Loop through the array and see if the contact is in your database. (**NOTE:** Record ids [can change](http://mattgemmell.com/2008/10/31/iphone-dev-tips-for-synced-contacts)!)
3. If you find a contact that is not in your database, add it.

It's probably also smart to store the [last modification date](http://developer.apple.com/library/ios/documentation/AddressBook/Reference/ABPersonRef_iPhoneOS/Reference/reference.html#//apple_ref/doc/c_ref/kABPersonModificationDateProperty) of the property and compare that with each record so you can know if something has changed on an existing record.

Finally, this could take a while depending on the number of contacts the user has. It's probably something you want to do without blocking the UI. (Another note: Address Book types are not thread safe. Keep this in mind if you're working in a background thread.)

While your app is running, you can register [address book change notification callback](http://tuvix.apple.com/library/ios/documentation/AddressBook/Reference/ABAddressBookRef_iPhoneOS/Reference/reference.html#//apple_ref/c/func/ABAddressBookRegisterExternalChangeCallback) to be alerted of changes that happen while your app is running.
A little easier way(don't need too much memory space):

1. Save your App's database lastest TimeStamp when you load data from AddressBook & total person count.
2. write a check function, and call it whenever you need it
3. check function : Get the latest modification date in all contacts, and get the total count right now, just compare the latest date with TimeStamp:

BOOL beNeedRefresh = NO;

if( latest > TimeStamp){

beNeedRefresh = YES;

}else if(addressbook count != your Database count){

beNeedRefresh = YES; 

}

if(beNeedRefresh){

refresh your database !!!!

}