Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Next Page > Hide TOC

ABMultiValue Class Objective-C Reference

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

Overview

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.

Tasks

Accessing the Primary Identifier

Accessing Identifiers

Accessing Entries

Querying the List

Instance Methods

count

- (NSUInteger)count

Discussion

Returns the number of entries in a multi-value list.

Availability
Declared In
ABMultiValue.h

identifierAtIndex:

- (NSString *)identifierAtIndex:(NSUInteger)index

Discussion

Returns the identifier for the given index. If the index argument is out of bounds, this method raises an exception.

Availability
See Also
Declared In
ABMultiValue.h

indexForIdentifier:

- (NSUInteger)indexForIdentifier:(NSString *)identifier

Discussion

Returns the index for the given identifier. Returns NSNotFound if the identifier is not found.

Availability
See Also
Declared In
ABMultiValue.h

labelAtIndex:

- (NSString *)labelAtIndex:(NSUInteger)index

Discussion

Returns the label for the given index. If the index argument is out of bounds, this method raises an exception.

Availability
See Also
Declared In
ABMultiValue.h

labelForIdentifier:

- (id)labelForIdentifier:(NSString *)identifier

Discussion

Returns the label for the given identifier. Returns nil if the identifier is not found.

Availability
See Also
Declared In
ABMultiValue.h

primaryIdentifier

- (NSString *)primaryIdentifier

Discussion

Returns the identifier for the primary value.

Availability
See Also
Declared In
ABMultiValue.h

propertyType

- (ABPropertyType)propertyType

Discussion

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.

Availability
Declared In
ABMultiValue.h

valueAtIndex:

- (id)valueAtIndex:(NSUInteger)index

Discussion

Returns the value for the given index. If the index argument is out of bounds, this method raises an exception.

Availability
See Also
Declared In
ABMultiValue.h

valueForIdentifier:

- (id)valueForIdentifier:(NSString *)identifier

Discussion

Returns the value for the given identifier. Returns nil if the identifier is not found.

Availability
See Also
Declared In
ABMultiValue.h

Next Page > Hide TOC


Last updated: 2007-07-08




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice