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

# SecKeychainItemCreatePersistentReference(_:_:)

Creates a persistent reference for a keychain item.

```
func SecKeychainItemCreatePersistentReference(_ itemRef: SecKeychainItem, _ persistentItemRef: UnsafeMutablePointer<CFData?>) -> OSStatus
```

## Parameters

`itemRef`

A keychain item reference for the item for which you want a persistent reference.

`persistentItemRef`

On return, a persistent reference for the keychain item. You must call the `CFRelease` function to release this object when you are finished using it.

## Return Value

A result code. See [Security Framework Result Codes](/documentation/Security/security-framework-result-codes).

## Discussion

Unlike normal references, a persistent reference may be stored on disk or passed between processes. You can convert a persistent reference into an ordinary keychain item reference (`SecKeychainItemRef`) by calling the [`SecKeychainItemCopyFromPersistentReference(_:_:)`](/documentation/Security/SecKeychainItemCopyFromPersistentReference(_:_:)) function.

## See Also

[`SecKeychainSearchCopyNext`](/documentation/Security/SecKeychainSearchCopyNext)

Finds the next keychain item matching the given search criteria.



---

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)