iOS Developer Library

Developer

AddressBookUI Framework Reference ABPeoplePickerNavigationController Class Reference

Options
Deployment Target:

On This Page
Language:

ABPeoplePickerNavigationController

The ABPeoplePickerNavigationController class (whose instances are known as people-picker navigation controllers) implements a view controller that manages a set of views that allow the user to select a contact or one of its contact-information items from an address book.

In iOS 8 and later bringing up a people-picker navigtion controller does not require the app to have access to a user’s contacts, and the user will not be prompted to grant access. If the app does not itself have access to the user’s contacts, a temporary copy of the contact selected by the user will be returned to the app.

See PeoplePicker: Picking a Person or Property for a sample project illustrating the use of a people-picker navigation controller.

Subclassing Notes

The ABPeoplePickerNavigationController class does not support subclassing.

Inheritance


Import Statement


Swift

import AddressBookUI

Objective-C

@import AddressBookUI;

Availability


Available in iOS 2.0 and later.
  • The properties (such as name or telephone number) the picker displays when it shows a person.

    Declaration

    Swift

    var displayedProperties: [AnyObject]!

    Objective-C

    @property(nonatomic, copy) NSArray *displayedProperties

    Discussion

    Objects in the array are instances of NSNumber that represent ABPropertyID values.

    The name property is always displayed if available.

    To have the picker display a single property for the person displayed, such as the telephone number, set displayedProperties to an array with a single value, such as kABPersonPhoneProperty.

    Import Statement

    Objective-C

    @import AddressBookUI;

    Swift

    import AddressBookUI

    Availability

    Available in iOS 2.0 and later.

  • Optional; the address book from which to obtain the list of contacts.

    Declaration

    Swift

    var addressBook: ABAddressBook!

    Objective-C

    @property(nonatomic, readwrite) ABAddressBookRef addressBook

    Discussion

    When unset, an address book is created and assigned to this property when needed. This property is only used when the app has access to the user’s contacts—otherwise it remains NULL.

    Import Statement

    Objective-C

    @import AddressBookUI;

    Swift

    import AddressBookUI

    Availability

    Available in iOS 2.0 and later.

  • The people-picker navigation controller delegate.

    Declaration

    Swift

    unowned(unsafe) var peoplePickerDelegate: ABPeoplePickerNavigationControllerDelegate!

    Objective-C

    @property(nonatomic, assign) id< ABPeoplePickerNavigationControllerDelegate > peoplePickerDelegate

    Discussion

    Optional to get the selected contact, selected property or cancellation of the people picker.

    Import Statement

    Objective-C

    @import AddressBookUI;

    Swift

    import AddressBookUI

    Availability

    Available in iOS 2.0 and later.

  • Optionally determines if a person can be selected.

    Declaration

    Swift

    @NSCopying var predicateForEnablingPerson: NSPredicate!

    Objective-C

    @property(nonatomic, copy) NSPredicate *predicateForEnablingPerson

    Discussion

    If not set, all persons are selectable.

    Import Statement

    Objective-C

    @import AddressBookUI;

    Swift

    import AddressBookUI

    Availability

    Available in iOS 8.0 and later.

  • Optionally determines if a selected person should be returned to the app or displayed.

    Declaration

    Swift

    @NSCopying var predicateForSelectionOfPerson: NSPredicate!

    Objective-C

    @property(nonatomic, copy) NSPredicate *predicateForSelectionOfPerson

    Discussion

    If the predicate evaluates to true for the selected person, the selected person is returned to the app. If the predicate evaluates to false, the selected person is displayed.

    If this property is nil, the person is returned to the app if the delegate implements peoplePickerNavigationController:didSelectPerson:, and the person is displayed if the delegate implements peoplePickerNavigationController:didSelectPerson:property:identifier:.

    Import Statement

    Objective-C

    @import AddressBookUI;

    Swift

    import AddressBookUI

    Availability

    Available in iOS 8.0 and later.

  • Optionally determines if a selected property should be returned to the app or if the default action for the property should be performed

    Declaration

    Swift

    @NSCopying var predicateForSelectionOfProperty: NSPredicate!

    Objective-C

    @property(nonatomic, copy) NSPredicate *predicateForSelectionOfProperty

    Discussion

    If the predicate evaluates to true, the selected property is returned to the app. If the predicate evaluates to false, the default action for the property is performed.

    If this property is nil, the selected property is returned to the app if the delegate implements peoplePickerNavigationController:didSelectPerson:property:identifier:.

    Import Statement

    Objective-C

    @import AddressBookUI;

    Swift

    import AddressBookUI

    Availability

    Available in iOS 8.0 and later.

  • These constants can be used in predicates for selecting people or properties. A labeled value is an object with a “label” property and a “value” property.

    Declaration

    Swift

    let ABPersonNamePrefixProperty: NSString! let ABPersonGivenNameProperty: NSString! let ABPersonMiddleNameProperty: NSString! let ABPersonFamilyNameProperty: NSString! let ABPersonNameSuffixProperty: NSString! let ABPersonPreviousFamilyNameProperty: NSString! let ABPersonNicknameProperty: NSString! let ABPersonPhoneticGivenNameProperty: NSString! let ABPersonPhoneticMiddleNameProperty: NSString! let ABPersonPhoneticFamilyNameProperty: NSString! let ABPersonOrganizationNameProperty: NSString! let ABPersonDepartmentNameProperty: NSString! let ABPersonJobTitleProperty: NSString! let ABPersonBirthdayProperty: NSString! let ABPersonNoteProperty: NSString! let ABPersonPhoneNumbersProperty: NSString! let ABPersonEmailAddressesProperty: NSString! let ABPersonUrlAddressesProperty: NSString! let ABPersonDatesProperty: NSString! let ABPersonInstantMessageAddressesProperty: NSString! let ABPersonRelatedNamesProperty: NSString! let ABPersonSocialProfilesProperty: NSString! let ABPersonPostalAddressesProperty: NSString!

    Objective-C

    NSString *const ABPersonNamePrefixProperty; NSString *const ABPersonGivenNameProperty; NSString *const ABPersonMiddleNameProperty; NSString *const ABPersonFamilyNameProperty; NSString *const ABPersonNameSuffixProperty; NSString *const ABPersonPreviousFamilyNameProperty; NSString *const ABPersonNicknameProperty; NSString *const ABPersonPhoneticGivenNameProperty; NSString *const ABPersonPhoneticMiddleNameProperty; NSString *const ABPersonPhoneticFamilyNameProperty; NSString *const ABPersonOrganizationNameProperty; NSString *const ABPersonDepartmentNameProperty; NSString *const ABPersonJobTitleProperty; NSString *const ABPersonBirthdayProperty; NSString *const ABPersonNoteProperty; NSString *const ABPersonPhoneNumbersProperty; NSString *const ABPersonEmailAddressesProperty; NSString *const ABPersonUrlAddressesProperty; NSString *const ABPersonDatesProperty; NSString *const ABPersonInstantMessageAddressesProperty ;] NSString *const ABPersonRelatedNamesProperty; NSString *const ABPersonSocialProfilesProperty; NSString *const ABPersonPostalAddressesProperty;

    Constants

    • ABPersonNamePrefixProperty

      ABPersonNamePrefixProperty

      The name prefix. Value is an NSString object.

      Available in iOS 8.0 and later.

    • ABPersonGivenNameProperty

      ABPersonGivenNameProperty

      The person’s given name. Value is an NSString object.

      Available in iOS 8.0 and later.

    • ABPersonMiddleNameProperty

      ABPersonMiddleNameProperty

      The person’s middle name. Value is an NSString object.

      Available in iOS 8.0 and later.

    • ABPersonFamilyNameProperty

      ABPersonFamilyNameProperty

      The person’s family name. Value is an NSString object.

      Available in iOS 8.0 and later.

    • ABPersonNameSuffixProperty

      ABPersonNameSuffixProperty

      The name suffix. Value is an NSString object.

      Available in iOS 8.0 and later.

    • ABPersonPreviousFamilyNameProperty

      ABPersonPreviousFamilyNameProperty

      The person’s previous family name. Value is an NSString object.

      Available in iOS 8.0 and later.

    • ABPersonNicknameProperty

      ABPersonNicknameProperty

      The person’s nickname. Value is an NSString object.

      Available in iOS 8.0 and later.

    • ABPersonPhoneticGivenNameProperty

      ABPersonPhoneticGivenNameProperty

      The person’s phonetic given name. Value is an NSString object.

      Available in iOS 8.0 and later.

    • ABPersonPhoneticMiddleNameProperty

      ABPersonPhoneticMiddleNameProperty

      The person’s phonetic middle name. Value is an NSString object.

      Available in iOS 8.0 and later.

    • ABPersonPhoneticFamilyNameProperty

      ABPersonPhoneticFamilyNameProperty

      The person’s phonetic family name. Value is an NSString object.

      Available in iOS 8.0 and later.

    • ABPersonOrganizationNameProperty

      ABPersonOrganizationNameProperty

      The person’s organization name. Value is an NSString object.

      Available in iOS 8.0 and later.

    • ABPersonDepartmentNameProperty

      ABPersonDepartmentNameProperty

      The person’s department name. Value is an NSString object.

      Available in iOS 8.0 and later.

    • ABPersonJobTitleProperty

      ABPersonJobTitleProperty

      The person’s job title. Value is an NSString object.

      Available in iOS 8.0 and later.

    • ABPersonBirthdayProperty

      ABPersonBirthdayProperty

      The person’s birthday. Value is an NSDateComponents object.

      Available in iOS 8.0 and later.

    • ABPersonNoteProperty

      ABPersonNoteProperty

      The note for the person. Value is an NSString object.

      Available in iOS 8.0 and later.

    • ABPersonPhoneNumbersProperty

      ABPersonPhoneNumbersProperty

      The person’s phone numbers. Value is an array of labeled values with phone number values.

      Available in iOS 8.0 and later.

    • ABPersonEmailAddressesProperty

      ABPersonEmailAddressesProperty

      The person’s email address. Value is an array of labeled values with NSString values.

      Available in iOS 8.0 and later.

    • ABPersonUrlAddressesProperty

      ABPersonUrlAddressesProperty

      The person’s URL addresses. Value is an array of labeled values with NSString values.

      Available in iOS 8.0 and later.

    • ABPersonDatesProperty

      ABPersonDatesProperty

      The person’s date. Value is an array of labeled values with NSDateComponents values.

      Available in iOS 8.0 and later.

    • ABPersonInstantMessageAddressesProperty

      ABPersonInstantMessageAddressesProperty

      The name prefix. Value is an array of labeled values with instant message address values. An instant message address has a “username” property and a “service” property.

      Available in iOS 8.0 and later.

    • ABPersonRelatedNamesProperty

      ABPersonRelatedNamesProperty

      The person’s related names. Value is an array of labeled values with NSString values.

      Available in iOS 8.0 and later.

    • ABPersonSocialProfilesProperty

      ABPersonSocialProfilesProperty

      The person’s social profiles. Value is an array of labeled values with social profile values. A social profile has a “username” property and a “service” property.

      Available in iOS 8.0 and later.

    • ABPersonPostalAddressesProperty

      ABPersonPostalAddressesProperty

      The person’s postal addresses. Value is an array of labeled values with postal address values. A postal address has a “street” property, a “subLocality” property, a “city” property, a “subAdministrativeArea” property, a “state” property, a “postalCode” property, a “country” property, and a “ISOCountryCode” property.

      Available in iOS 8.0 and later.