ABAddressBookRegisterExternalChangeCallback called several times
abaddressbook, ios, iphone
Solution
try this:
void addressBookChanged(ABAddressBookRef ab, CFDictionaryRef info, void *context){
ABAddressBookRevert(ab);
NSLog(@"ADDRESSBOOK CHANGED");
[phoneBookCopy updateCopy];
CFRelease(ab);
}
It was helped for me.
Problem
I have a strange problem where I register my iOS-app to listen to changes in the phones address book. The correct method is called when something changes in the address book but it gets called 2 - 6 times. When the object gets created (singleton, so only one object), I register for notifications with this code: ``` ABAddressBookRegisterExternalChangeCallback(notificationAddressBook, addressBookChanged, (__bridge_retained void *)self); ``` The method that is called looks like this: ``` void addressBookChanged(ABAddressBookRef ab, CFDictionaryRef info, void *context){ ABAddressBookRevert(ab); NSLog(@"ADDRESSBOOK CHANGED"); [phoneBookCopy updateCopy]; } ``` Any ideas how to solve this?