<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AddressBook",
  "identifier" : "/documentation/AddressBook/ABCopyArrayOfMatchingRecords(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Address Book"
    ],
    "preciseIdentifier" : "c:@F@ABCopyArrayOfMatchingRecords"
  },
  "title" : "ABCopyArrayOfMatchingRecords(_:_:)"
}
-->

# ABCopyArrayOfMatchingRecords(_:_:)

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

```
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: [`ABGroupCreateSearchElement(_:_:_:_:_:)`](/documentation/AddressBook/ABGroupCreateSearchElement(_:_:_:_:_:)) or [`ABPersonCreateSearchElement(_:_:_:_:_:)`](/documentation/AddressBook/ABPersonCreateSearchElement(_:_:_:_:_:)). See `ABSearchElement C` for more functions that create compound queries.

## 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.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)