---
title: SecIdentitySearchCopyNext
framework: security
role: symbol
role_heading: Function
path: security/secidentitysearchcopynext
---

# SecIdentitySearchCopyNext

Finds the next identity matching specified search criteria

## Declaration

```occ
OSStatus SecIdentitySearchCopyNext(SecIdentitySearchRef searchRef, SecIdentityRef*identity);
```

## Parameters

- `searchRef`: An identity search object specifying the search criteria for this search. You create the identity search object by calling the doc://com.apple.security/documentation/Security/SecIdentitySearchCreate function.
- `identity`: On return, points to the identity object of the next matching identity (if any). In Objective-C, call the doc://com.apple.documentation/documentation/CoreFoundation/CFRelease function to release this object when finished with it.

## Return Value

Return Value A result code. See Security Framework Result Codes. When there are no more identities that match the parameters specified to SecIdentitySearchCreate, errSecItemNotFound is returned.
