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.
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.
There's not an easy way to get "new contacts" in the address book. Instead you'll have to do something like this:
It's probably also smart to store the last modification date 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 to be alerted of changes that happen while your app is running.