iOS Developer Library

Developer

AddressBook Framework Reference ABSource Reference

Options
Deployment Target:

On This Page
Language:

ABSource Reference

Sources of contact information are represented by instances of the ABRecordRef opaque type, whose record type is kABSourceType. Examples of sources include the local address book database, CardDAV servers, and social networking sites.

Not all sources support groups. Each record in the address book database can belong to only one source. Folders from Exchange accounts are represented in the address book database as sources.

Functions

  • Returns the default source.

    Declaration

    Swift

    func ABAddressBookCopyDefaultSource(_ addressBook: ABAddressBook!) -> Unmanaged<ABRecord>!

    Objective-C

    ABRecordRef ABAddressBookCopyDefaultSource ( ABAddressBookRef addressBook );

    Parameters

    addressBook

    The address book whose default source is being returned.

    Return Value

    The default source record.

    Discussion

    This is the source used when creating new records if no source is specified.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 4.0 and later.

  • Returns the source record with the given record ID.

    Declaration

    Swift

    func ABAddressBookGetSourceWithRecordID(_ addressBook: ABAddressBook!, _ sourceID: ABRecordID) -> Unmanaged<ABRecord>!

    Objective-C

    ABRecordRef ABAddressBookGetSourceWithRecordID ( ABAddressBookRef addressBook, ABRecordID sourceID );

    Parameters

    addressBook

    The address book in which to search for recordID.

    sourceID

    The record identifier to seek in addressBook.

    Return Value

    If found, the source record with recordID as its identifier, otherwise NULL.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 4.0 and later.

  • Returns an array of all sources in the address book.

    Declaration

    Swift

    func ABAddressBookCopyArrayOfAllSources(_ addressBook: ABAddressBook!) -> Unmanaged<CFArray>!

    Objective-C

    CFArrayRef ABAddressBookCopyArrayOfAllSources ( ABAddressBookRef addressBook );

    Parameters

    addressBook

    The address book whose source records are being returned.

    Return Value

    Array containing the source records in addressBook.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 4.0 and later.

Data Types

  • Indicates a source type. See Source Properties.

    Declaration

    Swift

    typealias ABSourceType = Int32

    Objective-C

    typedef int ABSourceType;

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 4.0 and later.

Constants

  • Indicates that a source is searchable.

    Declaration

    Swift

    var kABSourceTypeSearchableMask: Int32 { get }

    Objective-C

    #define kABSourceTypeSearchableMask 0x01000000

    Constants

    • kABSourceTypeSearchableMask

      kABSourceTypeSearchableMask

      Indicates that a source is searchable.

      Available in iOS 4.0 and later.

  • These constants identify the type of a source.

    Declaration

    Swift

    var kABSourceTypeLocal: Int { get } var kABSourceTypeExchange: Int { get } var kABSourceTypeExchangeGAL: Int { get } var kABSourceTypeMobileMe: Int { get } var kABSourceTypeLDAP: Int { get } var kABSourceTypeCardDAV: Int { get } var kABSourceTypeCardDAVSearch: Int { get }

    Objective-C

    enum { kABSourceTypeLocal = 0x0, kABSourceTypeExchange = 0x1, kABSourceTypeExchangeGAL = kABSourceTypeExchange | kABSourceTypeSearchableMask, kABSourceTypeMobileMe = 0x2, kABSourceTypeLDAP = 0x3 | kABSourceTypeSearchableMask, kABSourceTypeCardDAV = 0x4, kABSourceTypeCardDAVSearch = kABSourceTypeCardDAV | kABSourceTypeSearchableMask, }; typedef int ABSourceType;

    Constants

    • kABSourceTypeLocal

      kABSourceTypeLocal

      Local address book database.

      Available in iOS 4.0 and later.

    • kABSourceTypeExchange

      kABSourceTypeExchange

      Exchange server.

      Available in iOS 4.0 and later.

    • kABSourceTypeExchangeGAL

      kABSourceTypeExchangeGAL

      Exchange Global Address List.

      Available in iOS 4.0 and later.

    • kABSourceTypeMobileMe

      kABSourceTypeMobileMe

      MobileMe.

      Available in iOS 4.0 and later.

    • kABSourceTypeLDAP

      kABSourceTypeLDAP

      LDAP server.

      Available in iOS 4.0 and later.

    • kABSourceTypeCardDAV

      kABSourceTypeCardDAV

      CardDAV server.

      Available in iOS 4.0 and later.

    • kABSourceTypeCardDAVSearch

      kABSourceTypeCardDAVSearch

      Searchable CardDAV server.

      Available in iOS 4.0 and later.

  • These constants identify source properties.

    Declaration

    Swift

    let kABSourceNameProperty: ABPropertyID let kABSourceTypeProperty: ABPropertyID

    Objective-C

    const ABPropertyID kABSourceNameProperty; const ABPropertyID kABSourceTypeProperty;

    Constants

    • kABSourceNameProperty

      kABSourceNameProperty

      The name of the source. Type: kABStringPropertyType.

      Available in iOS 4.0 and later.

    • kABSourceTypeProperty

      kABSourceTypeProperty

      The type of the source. Type: ABSourceType

      Available in iOS 4.0 and later.