<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 10.0.0 - 10.7.0"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SecIdentitySearchCopyNext",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@SecIdentitySearchCopyNext"
  },
  "title" : "SecIdentitySearchCopyNext"
}
-->

# SecIdentitySearchCopyNext

Finds the next identity matching specified search criteria

```
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 [`SecIdentitySearchCreate`](/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

A result code. See [Security Framework Result Codes](/documentation/Security/security-framework-result-codes). When there are no more identities that match the parameters specified to [`SecIdentitySearchCreate`](/documentation/Security/SecIdentitySearchCreate), [`errSecItemNotFound`](/documentation/Security/errSecItemNotFound) is returned.

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