Address Book is returning old values

Posted by Marcus Wood on Stack Overflow See other posts from Stack Overflow or by Marcus Wood
Published on 2009-11-12T20:46:57Z Indexed on 2010/05/26 10:01 UTC
Read the original article Hit count: 306

Filed under:
|
|

Hi there,

I am having a problem with the AddressBook framework. It all seems to be stemming from ABCopyRecordForUniqueId returning a record with old data.

Example:

I run up the program below in one terminal window - it shows the current data.

I make a change through the address book UI - my program continues to show old data.

I run up another instance of the same program in a new terminal window - it shows the updated data.

I have tried posting on the omnigroup site with no luck :( so any guidance is really appreciated

PS: If you would like to try the code, to get an address book ID you can export a contact as a vCard and open it with a text editor

int main (int argc, const char * argv[])
{   
ABAddressBookRef addressBook = ABGetSharedAddressBook();

while(1)
{
	ABRecordRef addressBookRecord = NULL;

	addressBookRecord = ABCopyRecordForUniqueId(addressBook, CFSTR("4064D587-0378-4DCF-A6B9-D3702F01C94C:ABPerson"));
	CFShow(addressBookRecord);

	CFRelease(addressBookRecord);

	sleep(1);
}

return 0;
}

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about data