I have an iPad-appliction t开发者_Go百科hat syncs contact with the contacts on server side.
How do I detect only that ABAdressbook-Entries that have changed? It is possible, that there occur changes on server-side, in my application, or externally on the ipad.
When I use
void ABAddressBookRegisterExternalChangeCallback (
ABAddressBookRef addressBook,
ABExternalChangeCallback callback,
void *context
);
I get the callback of external changes, but without any information about what changed. How do I get that information?
When I use the NSString * const kABModificationDateProperty
I don't know what to compare with.
I don't know, if you have got an solution for that. If not, probably this will help you:
NSArray *allPeople = (NSArray *)ABAddressBookCopyArrayOfAllPeople(yourAddressBook);
for (int i = 0; i < allPeople.count; i++) {
ABRecordRef *person = (ABAddressBookRef *)[allPeople abjectAtIndex:i];
NSDate *lastModiDate = (NSDate*)ABRecordCopyValue(person, kABPersonModificationDateProperty);
NSLog(@"Last modification date: %@ of entry: %@", lastModiDate, person);
}
You'll need to actually compare all of the fields between the server and the local book for each person that you want to sync.
精彩评论