0
votes

I'm developing an iPhone application which uses standard iPhone address book (database) of contacts. I need to add some extra property to contacts but as I see iOS API does not permit addition of extra/custom properties to contacts.

Questions: 1. Is there an ability to deal with extra properties in iOS adressbook API? 2. I need expert's advice about standard approaches of how to store extra data for users/contacts: using SQLite, XML or maybe there is some data store dedicated for every application?

2

2 Answers

1
votes

It isn't possible to append custom fields to Address Book records. You should consider looking into Core Data where you can store your custom fields mapped to a record ID.

-1
votes

Add custom property to address book.

The following code listing adds a custom property, and then removes it:

NSNumber* stringProperty = [NSNumber numberWithInteger:kABStringProperty];
NSString* testProperty = @"com.example.myProperty";
NSDictionary* dict = [NSDictionary dictionaryWithObject:stringProperty
                                                 forKey:testProperty];

NSInteger result = [ABPerson addPropertiesAndTypes:dict];
NSLog(@"Added %d properties.", result);

result = [ABPerson removeProperties:[NSArray arrayWithObject:testProperty]];
NSLog(@"Removed %d properties.", result);

More info:

https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AddressBook/Tasks/AddingProperties.html