| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AddressBook.framework |
| Availability | Available in Mac OS X v10.2 and later.
|
| Companion guide | |
| Declared in | ABRecord.h ABTypedefs.h |
ABRecord is an abstract superclass providing a common interface to and defining common properties for all Address Book records. A property is a field in the database record such as the first or last name of a person record. ABRecord defines the types of properties supported, and basic methods for getting, setting, and removing property values.
Use valueForProperty: to get a record’s property value, use setValue:forProperty: to set a value, and removeValueForProperty: to remove a value. Don’t just invoke setValue:forProperty: with nil as the property value argument, it will raises an exception.
Each record in the Address Book database has a corresponding unique ID obtained using the uniqueId method. The unique ID is used by other classes in the AddressBook framework.
Use isReadOnly to determine whether or not a record is read-only.
The ABRecord class is “toll-free bridged” with its procedural C, opaque type, counterpart. This means that the ABRecordRef type is interchangeable in function or method calls with instances of the ABRecord class.
Initializes the receiver and adds it to the given address book.
- (id)initWithAddressBook:(ABAddressBook *)addressBook
An address book that you want to initialize the receiver with.
The receiver is added to addressBook but is not visible to other address books until addressBook is saved. This is the designated initializer for this class.
ABRecord.h- (BOOL)isReadOnly
Returns YES if the record is read-only, NO otherwise.
ABRecord.h- (BOOL)removeValueForProperty:(NSString *)property
Removes the value for a given property. When you next call valueForProperty: on that property, it returns nil.
If property is nil, this method raises an exception. This method returns YES if the value is removed successfully, NO otherwise.
ABRecord.h- (BOOL)setValue:(id)value forProperty:(NSString *)property
Sets the value of a given property for a record. The type of the value must match the property’s type (see “Constants” for a list of possible property types). If property is nil or if value is not of the correct type, this method raises an exception. If property is a multi-value list property, this method checks to see if the values in the multi-value list are the same type. If the multi-value list contains mixed types, this method returns NO. This method returns YES if the value was set successfully, and NO otherwise.
ABRecord.h- (NSString *)uniqueId
Returns the unique ID of the receiver. This method is equivalent to invoking valueForProperty: passing kABUIDProperty as the argument.
– recordForUniqueId: (ABAddressBook)ABRecord.h- (id)valueForProperty:(NSString *)property
Returns the value of the given property. The type of the value depends on the property type (see “Constants” for a list of possible property types). Note that the retuned value is always of an immutable type (for example, an NSString not an NSMutableString is returned).
If property is nil, this method raises an exception.
ABRecord.hThese are of type ABPropertyType and describe the possible types for ABRecord properties:
These properties are in all types of records.
Last updated: 2006-07-26