AddressBook Functions

Find the C functions and function-like macros you use to manipulate Address Book data.

Topics

Address Book

func ABGetSharedAddressBook() -> Unmanaged<ABAddressBookRef>!

Returns the unique shared ABAddressBook object.

func ABCopyDefaultCountryCode(ABAddressBookRef!) -> Unmanaged<CFString>!

Returns the default country code for records with unspecified country codes.

func ABHasUnsavedChanges(ABAddressBookRef!) -> Bool

Returns whether if there are unsaved changes in the address book.

func ABSave(ABAddressBookRef!) -> Bool

Saves all the changes made since the last save.

People

func ABCopyArrayOfAllPeople(ABAddressBookRef!) -> Unmanaged<CFArray>!

Returns an array of all the people in the Address Book database.

func ABGetMe(ABAddressBookRef!) -> Unmanaged<ABPersonRef>!

Returns the ABPerson object for the logged-in user.

func ABPersonCopyImageData(ABRecord!) -> Unmanaged<CFData>!

Returns data that contains a picture of a person.

func ABPersonCopyParentGroups(ABPersonRef!) -> Unmanaged<CFArray>!

Returns an array of groups that a person belongs to.

func ABPersonCopyVCardRepresentation(ABPersonRef!) -> Unmanaged<CFData>!

Returns the vCard representation of the person as a data object in vCard format.

func ABPersonCreate() -> Unmanaged<ABRecord>!

Returns a newly created person object.

func ABPersonCreateWithVCardRepresentation(CFData!) -> Unmanaged<ABPersonRef>!

Returns a new ABPerson object initialized with the given data in vCard format.

func ABSetMe(ABAddressBookRef!, ABPersonRef!)

Sets the record that represents the logged-in user.

Groups

func ABCopyArrayOfAllGroups(ABAddressBookRef!) -> Unmanaged<CFArray>!

Returns an array of all the groups in the Address Book database.

func ABGroupCopyArrayOfAllSubgroups(ABGroupRef!) -> Unmanaged<CFArray>!

Returns an array containing a group’s subgroups.

func ABGroupCopyDistributionIdentifier(ABGroupRef!, ABPersonRef!, CFString!) -> Unmanaged<CFString>!

Returns the distribution identifier for the given property and person.

func ABGroupCopyParentGroups(ABGroupRef!) -> Unmanaged<CFArray>!

Returns an array containing a group’s parents—the groups that a group belongs to.

func ABGroupSetDistributionIdentifier(ABGroupRef!, ABPersonRef!, CFString!, CFString!) -> Bool

Assigning a specific distribution identifier for a person’s multi-value list property so that the group can be used as a distribution list (mailing list, in the case of an email property).

Multi Values

func ABMultiValueCount(ABMultiValueRef!) -> CFIndex

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

func ABMultiValueCreateMutable(ABPropertyType) -> Unmanaged<ABMutableMultiValue>!

Returns a newly created mutable multi-value list object.

func ABMultiValuePropertyType(ABMultiValueRef!) -> ABPropertyType

Returns the type for the values in a multi-value list.

func ABMultiValueRemove(ABMutableMultiValueRef!, CFIndex) -> Bool

Removes the value and label at the given index.

func ABMultiValueSetPrimaryIdentifier(ABMutableMultiValueRef!, CFString!) -> Bool

Sets the primary value to be the value for the given identifier.

Images

func ABBeginLoadingImageDataForClient(ABPersonRef!, ABImageClientCallback!, UnsafeMutableRawPointer!) -> CFIndex

Starts an asynchronous fetch for image data in all locations, and returns a non-zero tag for tracking.

func ABCancelLoadingImageDataForTag(CFIndex)

Cancels an asynchronous fetch of an image for the given tag.

Search Elements

func ABCopyArrayOfMatchingRecords(ABAddressBookRef!, ABSearchElementRef!) -> Unmanaged<CFArray>!

Returns an array of records that match the given search element, or an empty array if no records match the search element.

func ABSearchElementCreateWithConjunction(ABSearchConjunction, CFArray!) -> Unmanaged<ABSearchElementRef>!

Returns a compound search element created by combining the search elements in an array with the given conjunction.

func ABSearchElementMatchesRecord(ABSearchElementRef!, ABRecordRef!) -> Bool

Tests whether or not a record matches a search element.

Properties

func ABAddPropertiesAndTypes(ABAddressBookRef!, CFString!, CFDictionary!) -> CFIndex

Adds the given properties to all the records of the specified type in the Address Book database, and returns the number of properties successfully added.

func ABCopyArrayOfPropertiesForRecordType(ABAddressBookRef!, CFString!) -> Unmanaged<CFArray>!

Returns an array containing the names of all the properties for the specified record type.

func ABCopyLocalizedPropertyOrLabel(CFString!) -> Unmanaged<CFString>!

Returns the localized version of a built in property, label, or key.

func ABLocalizedPropertyOrLabel(String!) -> String!

Returns the localized version of a built in property, label, or key.

func ABRemoveProperties(ABAddressBookRef!, CFString!, CFArray!) -> CFIndex

Removes the given properties from all the records of this type in the Address Book database, and returns the number of properties successfully removed.

func ABTypeOfProperty(ABAddressBookRef!, CFString!, CFString!) -> ABPropertyType

Returns the type of a given property for a given record.

Deprecated

func ABAddressBookCopyArrayOfAllGroups(ABAddressBook!) -> Unmanaged<CFArray>!

Returns an array with all the groups in an address book.

Deprecated
func ABAddressBookCopyArrayOfAllGroupsInSource(ABAddressBook!, ABRecord!) -> Unmanaged<CFArray>!

Returns an array of all groups from a particular source.

Deprecated
func ABAddressBookCopyArrayOfAllPeople(ABAddressBook!) -> Unmanaged<CFArray>!

Returns all the person records in an address book.

Deprecated
func ABAddressBookCopyArrayOfAllPeopleInSource(ABAddressBook!, ABRecord!) -> Unmanaged<CFArray>!

Returns an array of all person records from a particular source.

Deprecated
func ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering(ABAddressBook!, ABRecord!, ABPersonSortOrdering) -> Unmanaged<CFArray>!

Returns an array of all person records in the address book, sorted with the specified order.

Deprecated
func ABAddressBookCopyArrayOfAllSources(ABAddressBook!) -> Unmanaged<CFArray>!

Returns an array of all sources in the address book.

Deprecated
func ABAddressBookCopyLocalizedLabel(CFString!) -> Unmanaged<CFString>!

Returns a localized version of a record-property label.

Deprecated
func ABAddressBookCopyPeopleWithName(ABAddressBook!, CFString!) -> Unmanaged<CFArray>!

Performs a prefix search on the composite names of people in an address book and returns an array of persons that match the search criteria.

Deprecated
func ABAddressBookCreate() -> Unmanaged<ABAddressBook>!

Creates a new address book object with data from the Address Book database.

Deprecated
func ABAddressBookCreateWithOptions(CFDictionary!, UnsafeMutablePointer<Unmanaged<CFError>?>!) -> Unmanaged<ABAddressBook>!

Creates a new address book object with data from the Address Book database.

Deprecated
func ABAddressBookGetAuthorizationStatus() -> ABAuthorizationStatus

Returns the authorization status of your app for accessing address book data.

Deprecated
func ABAddressBookGetGroupCount(ABAddressBook!) -> CFIndex

Returns the number of groups in an address book.

Deprecated
func ABAddressBookGetPersonCount(ABAddressBook!) -> CFIndex

Returns the number of person records in an address book.

Deprecated
func ABAddressBookGetSourceWithRecordID(ABAddressBook!, ABRecordID) -> Unmanaged<ABRecord>!

Returns the source record with the given record ID.

Deprecated
func ABAddressBookHasUnsavedChanges(ABAddressBook!) -> Bool

Indicates whether an address book has changes that have not been saved to the Address Book database.

Deprecated
func ABAddressBookRegisterExternalChangeCallback(ABAddressBook!, ABExternalChangeCallback!, UnsafeMutableRawPointer!)

Registers a callback to receive notifications when the Address Book database is modified.

Deprecated
func ABAddressBookRevert(ABAddressBook!)

Discards unsaved changes in an address book.

Deprecated
func ABAddressBookSave(ABAddressBook!, UnsafeMutablePointer<Unmanaged<CFError>?>!) -> Bool

Saves any unsaved changes to the Address Book database.

Deprecated
func ABGroupCopySource(ABRecord!) -> Unmanaged<ABRecord>!

Returns the source that the group is from.

Deprecated
func ABGroupCreateInSource(ABRecord!) -> Unmanaged<ABRecord>!

Creates a group in a particular source.

Deprecated
func ABMultiValueCopyArrayOfAllValues(ABMultiValue!) -> Unmanaged<CFArray>!

Returns an array with the values in a multivalue property.

Deprecated
func ABMultiValueGetCount(ABMultiValue!) -> CFIndex

Returns the number of values in a multivalue property.

Deprecated
func ABMultiValueGetFirstIndexOfValue(ABMultiValue!, CFTypeRef!) -> CFIndex

Returns the first location of a value in a multivalue property.

Deprecated
func ABMultiValueGetIdentifierAtIndex(ABMultiValue!, CFIndex) -> ABMultiValueIdentifier

Returns the identifier of a value in a multivalue property.

Deprecated
func ABMultiValueGetIndexForIdentifier(ABMultiValue!, ABMultiValueIdentifier) -> CFIndex

Returns the location (within a multivalue property) of a value with a given identifier.

Deprecated
func ABMultiValueGetPropertyType(ABMultiValue!) -> ABPropertyType

Returns the type of the values contained in a multivalue property.

Deprecated
func ABMultiValueReplaceLabelAtIndex(ABMutableMultiValue!, CFString!, CFIndex) -> Bool

Replaces a label in a multivalue property with another label.

Deprecated
func ABMultiValueReplaceValueAtIndex(ABMutableMultiValue!, CFTypeRef!, CFIndex) -> Bool

Replaces a value in a multivalue property with another value.

Deprecated
func ABPersonCopyArrayOfAllLinkedPeople(ABRecord!) -> Unmanaged<CFArray>!

Returns an array of all person records in the address book database that are linked to the given person record.

Deprecated
func ABPersonCopyCompositeNameDelimiterForRecord(ABRecord!) -> Unmanaged<CFString>!

Returns the delimiter to use between name components.

Deprecated
func ABPersonCopyImageDataWithFormat(ABRecord!, ABPersonImageFormat) -> Unmanaged<CFData>!

Returns the picture for a person record in the given format.

Deprecated
func ABPersonCopyLocalizedPropertyName(ABPropertyID) -> Unmanaged<CFString>!

Returns the localized name of a person property

Deprecated
func ABPersonCopySource(ABRecord!) -> Unmanaged<ABRecord>!

Returns the source that the person record is from.

Deprecated
func ABPersonCreateInSource(ABRecord!) -> Unmanaged<ABRecord>!

Creates a new person record in a particular source.

Deprecated
func ABPersonCreatePeopleInSourceWithVCardRepresentation(ABRecord!, CFData!) -> Unmanaged<CFArray>!

Creates person records from the given vCard representation.

Deprecated
func ABPersonCreateVCardRepresentationWithPeople(CFArray!) -> Unmanaged<CFData>!

Returns the vCard representation of the given person records.

Deprecated
func ABPersonGetCompositeNameFormat() -> ABPersonCompositeNameFormat

Returns the person-name display format.

Deprecated
func ABPersonGetCompositeNameFormatForRecord(ABRecord!) -> ABPersonCompositeNameFormat

Returns the person-name display format to use for the given record.

Deprecated
func ABPersonGetSortOrdering() -> ABPersonSortOrdering

Returns the user’s sort-ordering preference for lists of persons.

Deprecated
func ABPersonGetTypeOfProperty(ABPropertyID) -> ABPropertyType

Returns the type of a person property.

Deprecated
func ABPersonHasImageData(ABRecord!) -> Bool

Indicates whether a person has a picture.

Deprecated
func ABRecordCopyCompositeName(ABRecord!) -> Unmanaged<CFString>!

Returns an appropriate, human-friendly name for the record.

Deprecated
func ABRecordGetRecordID(ABRecord!) -> ABRecordID

Returns the unique ID of a record.

Deprecated
func ABRecordGetRecordType(ABRecord!) -> ABRecordType

Returns the type of a record.

Deprecated

See Also

C Interfaces

C Types

Identify the C types that correspond to Address Book objects.

Address Book Constants

Get the constants you use to specify Address Book information.

AddressBook Enumerations

Get the enumerations you use to specify Address Book information.

AddressBook Data Types

Get the data types you use to specify Address Book information.