| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AddressBook.framework |
| Availability | Available in Mac OS X v10.2 and later.
|
| Companion guide | |
| Declared in | ABMultiValue.h |
The ABMultiValue and ABMutableMultiValue classes are used to represent properties that might have multiple values. Each value in a multi-value list must be the same type, and has an associated pre-defined or user-defined label, and unique identifier. The labels, however, need not be unique. For example, you can have multiple “Home” phone numbers. Each multi-value object may have a primary identifier—used as a default value when a label is not provided. For example, a person record may have multiple addresses with the labels “Home” and “Work”, where “Work” is designated as the primary value. Instances of this class are immutable, see ABMutableMultiValue for methods that manipulate the content of a multi-value list.
You can access values using a numeric index (similar to an array). Use the identifierAtIndex: method to get an identifier, the labelAtIndex: method to get a label, and the valueAtIndex: method to get a value. However, a numeric index is temporary since a multi-value list may change. Each value or entry in a multi-value list has a unique identifier which can be used to save a reference to a specific value—the identifier is guaranteed never to change.
Use the primaryIdentifier method to get the primary identifier (the identifier associated with the primary value).
The ABMultiValue class is “toll-free bridged” with its procedural C, opaque type, counterpart. This means that the ABMultiValueRef type is interchangeable in function or method calls with instances of the ABMultiValue class.
- (NSUInteger)count
Returns the number of entries in a multi-value list.
ABMultiValue.h- (NSString *)identifierAtIndex:(NSUInteger)index
Returns the identifier for the given index. If the index argument is out of bounds, this method raises an exception.
ABMultiValue.h- (NSUInteger)indexForIdentifier:(NSString *)identifier
Returns the index for the given identifier. Returns NSNotFound if the identifier is not found.
ABMultiValue.h- (NSString *)labelAtIndex:(NSUInteger)index
Returns the label for the given index. If the index argument is out of bounds, this method raises an exception.
ABMultiValue.h- (id)labelForIdentifier:(NSString *)identifier
Returns the label for the given identifier. Returns nil if the identifier is not found.
ABMultiValue.h- (NSString *)primaryIdentifier
Returns the identifier for the primary value.
– indexForIdentifier:– setPrimaryIdentifier: (ABMutableMultiValue)ABMultiValue.h- (ABPropertyType)propertyType
Returns the type for the values in a multi-value list. If the multi-value list is empty or its values are of different types, it returns kABErrorInProperty.
ABMultiValue.h- (id)valueAtIndex:(NSUInteger)index
Returns the value for the given index. If the index argument is out of bounds, this method raises an exception.
ABMultiValue.h- (id)valueForIdentifier:(NSString *)identifier
Returns the value for the given identifier. Returns nil if the identifier is not found.
ABMultiValue.h
Last updated: 2007-07-08