---
title: "ABCopyArrayOfMatchingRecords(_:_:)"
framework: addressbook
role: symbol
role_heading: Function
path: "addressbook/abcopyarrayofmatchingrecords(_:_:)"
---

# ABCopyArrayOfMatchingRecords(_:_:)

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

## Declaration

```swift
func ABCopyArrayOfMatchingRecords(_ addressBook: ABAddressBookRef!, _ search: ABSearchElementRef!) -> Unmanaged<CFArray>!
```

## Parameters

- `addressBook`: The address book for the logged-in user.
- `search`: The search element that specifies the query. If search is NULL, this function raises an exception. Create an ABSearchElement object using the record specific functions: doc://com.apple.addressbook/documentation/AddressBook/ABGroupCreateSearchElement(_:_:_:_:_:) or doc://com.apple.addressbook/documentation/AddressBook/ABPersonCreateSearchElement(_:_:_:_:_:). See ABSearchElement C for more functions that create compound queries.

## Return Value

Return Value A new array containing ABRecord objects representing all the records that match search. If no records match search, this function returns an empty array. You are responsible for releasing this object.

## See Also

### Search Elements

- [ABSearchElementCreateWithConjunction(_:_:)](addressbook/absearchelementcreatewithconjunction(_:_:).md)
- [ABSearchElementMatchesRecord(_:_:)](addressbook/absearchelementmatchesrecord(_:_:).md)
