ABGroup Reference
| Framework | AddressBook/AddressBook.h |
| Declared in | ABGroup.h |
Overview
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 by Task
Creating Groups
Managing Group Members
-
ABGroupCopyArrayOfAllMembers -
ABGroupCopyArrayOfAllMembersWithSortOrdering -
ABGroupAddMember -
ABGroupRemoveMember
Accessing the Groups in an Address Book
Functions
ABAddressBookCopyArrayOfAllGroups
Returns an array with all the groups in an address book.
CFArrayRef ABAddressBookCopyArrayOfAllGroups ( ABAddressBookRef addressBook );
Parameters
- addressBook
The address book from which to return the groups.
Return Value
An array containing the groups in addressBook.
Availability
- Available in iOS 2.0 and later.
Declared In
ABGroup.hABAddressBookCopyArrayOfAllGroupsInSource
Returns an array of all groups from a particular source.
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.
Availability
- Available in iOS 4.0 and later.
Declared In
ABGroup.hABAddressBookGetGroupCount
Returns the number of groups in an address book.
CFIndex ABAddressBookGetGroupCount ( ABAddressBookRef addressBook );
Parameters
- addressBook
The address book whose record count is being returned.
Return Value
The number of groups in addressBook.
Availability
- Available in iOS 2.0 and later.
Declared In
ABGroup.hABAddressBookGetGroupWithRecordID
Returns the group with a given record ID.
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.
Availability
- Available in iOS 2.0 and later.
Declared In
ABGroup.hABGroupAddMember
Adds a person record to a group.
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.
Availability
- Available in iOS 2.0 and later.
Declared In
ABGroup.hABGroupCopyArrayOfAllMembers
Returns the records in a group.
CFArrayRef ABGroupCopyArrayOfAllMembers ( ABRecordRef group );
Parameters
- group
The group whose records are being returned.
Return Value
An array containing the records in group.
Availability
- Available in iOS 2.0 and later.
Declared In
ABGroup.hABGroupCopyArrayOfAllMembersWithSortOrdering
Returns the records in a group, using a sort ordering.
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” in ABPerson Reference.
Return Value
An array containing the records in group using sortOrdering.
Availability
- Available in iOS 2.0 and later.
Declared In
ABGroup.hABGroupCopySource
Returns the source that the group is from.
ABRecordRef ABGroupCopySource ( ABRecordRef group );
Parameters
- group
The group whose source is being returned.
Return Value
The source that the group record is from.
Availability
- Available in iOS 4.0 and later.
Declared In
ABGroup.hABGroupCreate
Creates a group record.
ABRecordRef ABGroupCreate ( void );
Availability
- Available in iOS 2.0 and later.
Declared In
ABGroup.hABGroupCreateInSource
Creates a group in a particular source.
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.
Availability
- Available in iOS 4.0 and later.
Declared In
ABGroup.hABGroupRemoveMember
Removes a record from a group.
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.
Availability
- Available in iOS 2.0 and later.
Declared In
ABGroup.hConstants
Group Properties
This constant identifies the properties of groups.
const int kABGroupNameProperty;
Constants
kABGroupNamePropertyGroup name property.
Available in iOS 2.0 and later.
Declared in
ABGroup.h.
© 2010 Apple Inc. All Rights Reserved. (Last updated: 2010-07-06)