iOS Developer Library

Developer

AddressBook Framework Reference ABGroup Reference

Options
Deployment Target:

On This Page
Language:

ABGroup Reference

Inherits From


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import AddressBook

Objective-C

@import AddressBook;

Group records are represented by instances of the ABRecordRef opaque type, whose record type is kABGroupType. Person records may belong to multiple groups. Groups may not contain other groups.

Functions

  • Creates a group record.

    Declaration

    Swift

    func ABGroupCreate() -> Unmanaged<ABRecord>!

    Objective-C

    ABRecordRef ABGroupCreate ( void );

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 2.0 and later

  • Creates a group in a particular source.

    Declaration

    Swift

    func ABGroupCreateInSource(_ source: ABRecord!) -> Unmanaged<ABRecord>!

    Objective-C

    ABRecordRef ABGroupCreateInSource ( ABRecordRef source );

    Parameters

    source

    The source to create the group in.

    Return Value

    A new group in the specified source.

    Discussion

    If source is NULL, the group is created in the default source.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 4.0 and later

  • Returns the records in a group.

    Declaration

    Swift

    func ABGroupCopyArrayOfAllMembers(_ group: ABRecord!) -> Unmanaged<CFArray>!

    Objective-C

    CFArrayRef ABGroupCopyArrayOfAllMembers ( ABRecordRef group );

    Parameters

    group

    The group whose records are being returned.

    Return Value

    An array containing the records in group.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 2.0 and later

  • Returns the records in a group, using a sort ordering.

    Declaration

    Swift

    func ABGroupCopyArrayOfAllMembersWithSortOrdering(_ group: ABRecord!, _ sortOrdering: ABPersonSortOrdering) -> Unmanaged<CFArray>!

    Objective-C

    CFArrayRef ABGroupCopyArrayOfAllMembersWithSortOrdering ( ABRecordRef group, ABPersonSortOrdering sortOrdering );

    Parameters

    group

    The group whose records are being returned.

    sortOrdering

    The order in which you want the returned records. See Sort Order.

    Return Value

    An array containing the records in group using sortOrdering.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 2.0 and later

  • Adds a person record to a group.

    Declaration

    Swift

    func ABGroupAddMember(_ group: ABRecord!, _ person: ABRecord!, _ error: UnsafeMutablePointer<Unmanaged<CFError>?>) -> Bool

    Objective-C

    bool ABGroupAddMember ( ABRecordRef group, ABRecordRef person, CFErrorRef *error );

    Parameters

    group

    The group that the person record is being added to.

    person

    The person record to add to group.

    error

    On error, information about the cause.

    Return Value

    true when person is added to group; otherwise false.

    Discussion

    Before a person record can be added to a group, the record must be saved to the Address Book database.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 2.0 and later

  • Removes a record from a group.

    Declaration

    Swift

    func ABGroupRemoveMember(_ group: ABRecord!, _ record: ABRecord!, _ error: UnsafeMutablePointer<Unmanaged<CFError>?>) -> Bool

    Objective-C

    bool ABGroupRemoveMember ( ABRecordRef group, ABRecordRef member, CFErrorRef *error );

    Parameters

    group

    The group from which to remove record.

    record

    The record to remove from group.

    error

    On error, information about the cause.

    Return Value

    true when record is removed from group; otherwise false.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 2.0 and later

  • Returns the group with a given record ID.

    Declaration

    Swift

    func ABAddressBookGetGroupWithRecordID(_ addressBook: ABAddressBook!, _ recordID: ABRecordID) -> Unmanaged<ABRecord>!

    Objective-C

    ABRecordRef ABAddressBookGetGroupWithRecordID ( ABAddressBookRef addressBook, ABRecordID recordID );

    Parameters

    addressBook

    The address book in which to look for the record.

    recordID

    The record ID of the group being returned.

    Return Value

    If found, the group with recordID as its identifier; otherwise, NULL.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 2.0 and later

  • Returns the number of groups in an address book.

    Declaration

    Swift

    func ABAddressBookGetGroupCount(_ addressBook: ABAddressBook!) -> CFIndex

    Objective-C

    CFIndex ABAddressBookGetGroupCount ( ABAddressBookRef addressBook );

    Parameters

    addressBook

    The address book whose record count is being returned.

    Return Value

    The number of groups in addressBook.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 2.0 and later

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

    Declaration

    Swift

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

    Objective-C

    CFArrayRef ABAddressBookCopyArrayOfAllGroups ( ABAddressBookRef addressBook );

    Parameters

    addressBook

    The address book from which to return the groups.

    Return Value

    An array containing the groups in addressBook.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 2.0 and later

  • Returns an array of all groups from a particular source.

    Declaration

    Swift

    func ABAddressBookCopyArrayOfAllGroupsInSource(_ addressBook: ABAddressBook!, _ source: ABRecord!) -> Unmanaged<CFArray>!

    Objective-C

    CFArrayRef ABAddressBookCopyArrayOfAllGroupsInSource ( ABAddressBookRef addressBook, ABRecordRef source );

    Parameters

    addressBook

    The address book whose records are being returned.

    source

    The source whose groups are being returned.

    Return Value

    An array of all groups from a particular source.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 4.0 and later

  • Returns the source that the group is from.

    Declaration

    Swift

    func ABGroupCopySource(_ group: ABRecord!) -> Unmanaged<ABRecord>!

    Objective-C

    ABRecordRef ABGroupCopySource ( ABRecordRef group );

    Parameters

    group

    The group whose source is being returned.

    Return Value

    The source that the group record is from.

    Import Statement

    Objective-C

    @import AddressBook;

    Swift

    import AddressBook

    Availability

    Available in iOS 4.0 and later

Constants

  • This constant identifies the properties of groups.

    Declaration

    Swift

    let kABGroupNameProperty: Int32

    Objective-C

    const int kABGroupNameProperty;

    Constants

    • kABGroupNameProperty

      kABGroupNameProperty

      Group name property.

      Available in iOS 2.0 and later