Ruchir Shah
Ruchir Shah

Reputation: 896

How to create string property for each address book record?

I want to store network carrier as a string (e.g. AT&T) for each contact in address book.

I found a method addPropertiesAndTypes for creating a custom property. But I am not able to find any proper example to do this.

I am using following code to iterate through contact book records:

ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef addressArr = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFIndex nPeople = ABAddressBookGetPersonCount(addressBook);
for(int i=0; i<nPeople; i++) {

    ABRecordRef recref = CFArrayGetValueAtIndex(addressArr, i);
}

And my query is, the property will stay with value after app is closed. Are these property is getting saved in address book database?

Help needed. Thanks.

Upvotes: 1

Views: 271

Answers (1)

Costique
Costique

Reputation: 23722

Make sure you call ABAddressBookSave().

Upvotes: 1

Related Questions