| 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 |
| Related sample code |
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.
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 a record using the shared address book.
- (id) init
On Mac OS X 10.5 and later, this is equivalent to initWithAddressBook:[ABAddressBook addressBook].
ABRecord.h Initializes a record using the given address book.
- (id) initWithAddressBook:(ABAddressBook *) addressBook
The address book with which to initialize the record.
The record is added to addressBook but is not visible to other address books until addressBook is saved. This method is the designated initializer for this class.
ABRecord.h Returns whether a record is read-only.
- (BOOL) isReadOnly
YES if the record is read-only; otherwise, NO.
ABRecord.h Removes the value for a given property.
- (BOOL) removeValueForProperty:(NSString *) property
The property whose value will be removed.
YES if the value is removed successfully; otherwise, NO.
When you next call valueForProperty: on that property, it returns nil.
If property is nil, this method raises an exception.
ABRecord.h Sets the value of a given property for a record.
- (BOOL) setValue:( id) value forProperty:(NSString *) property
The value to set for property.
The property whose value will be set.
YES if the value was set successfully; otherwise, NO.
The type of the value must match the property’s type (see “Property Types” in Address Book Objective-C Constants Reference 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 multivalue list property, this method checks to see if the values in the multivalue list are the same type. If the multivalue list contains mixed types, the value will not be set successfully.
ABRecord.h Returns the unique ID for a record.
- (NSString *) uniqueId
The unique ID.
This method is equivalent to invoking valueForProperty:, passing kABUIDProperty as the argument.
– recordForUniqueId:(ABAddressBook)ABRecord.h Returns the value of a given property for a record.
- (id) valueForProperty:(NSString *) property
The property whose value will be returned.
The value of the given property.
The type of the value depends on the property type (see “Property Types” in Address Book Objective-C Constants Reference for a list of possible property types). Note that the retuned value is always of an immutable type (for example, an NSString type, not an NSMutableString type, is returned).
If property is nil, this method raises an exception.
ABRecord.h
Last updated: 2009-07-23