开发者

Syncing ABAddressbook-Entries

开发者 https://www.devze.com 2023-02-24 07:59 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号