You can add your own properties to the people and groups in the Address Book. For example, if you’re creating a small application to manage a dog club, you could add properties to each person that specify the name and breed of that person’s dog. Or if you’re creating an application to manage business contacts, you could add a property that lists all the meetings and phone calls a user has had with that person. These properties are stored in the Address Book database. Applications that don’t know about the new properties aren’t affected by them and don’t modify them.
When deciding whether to add a property to the Address Book, keep these issues in mind:
Avoid properties for confidential information, such as credit card numbers. The Address Book does not provide any security above what’s provided by Mac OS X. Anyone who has read and write access to a user’s home folder can also read and write that user’s address book.
Avoid properties that are not useful for everyone in the address book. If you want to store information for just the logged-in user, consider using the NSUserDefaults or CFPreference APIs.
Use a multivalue list if you think a person may have more than one of that property. Your new multivalue list has the same capabilities as the other multivalue lists in the address book. The user can choose a primary value in the list and can create distribution lists for it.
To add properties to every person or group, use the ABPerson or ABGroup class method addPropertiesAndTypes:
. These procedures take a NSDictionary or CFDictionary, in which the keys are the names of the new properties and the values are their types. Note that the property names must be unique. You may want to use Java-style package names for your properties, to make sure no one else uses the same name; for example, "org.dogclub.dogname"
or "com.mycompany.meetinglist"
. The type can be one of five types or a multivalue list of one of those types. Here are the types:
kABRealProperty
or kABMultiRealProperty
(a floating-point number)
kABDateProperty
or kABMultiDateProperty
(an NSDate)
kABArrayProperty
or kABMultiArrayProperty
(an NSArray)
kABDictionaryProperty
or kABMultiDictionaryProperty
(an NSDictionary)
kABDataProperty
or kABMultiDataProperty
(an NSData)
© 2002, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-04-04)