<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMMetadataCreateKeyFromIdentifier(allocator:identifier:keyOut:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Media"
    ],
    "preciseIdentifier" : "c:@F@CMMetadataCreateKeyFromIdentifier"
  },
  "title" : "CMMetadataCreateKeyFromIdentifier(allocator:identifier:keyOut:)"
}
-->

# CMMetadataCreateKeyFromIdentifier(allocator:identifier:keyOut:)

Creates a copy of the key by using an identifier.

```
func CMMetadataCreateKeyFromIdentifier(allocator: CFAllocator?, identifier: CFString, keyOut: UnsafeMutablePointer<CFTypeRef?>) -> OSStatus
```

## Parameters

`allocator`

The allocator to use for creating the identifier.

`identifier`

The identifier to be inspected.

`keyOut`

Upon return, a pointer to the key data that was used to create the identifier.

## Return Value

If successful, a nonzero result code. See [Metadata Identifier Error Codes](/documentation/CoreMedia/metadata-identifier-errors).

## Discussion

The returned `CFType` is based on the keyspace encoded in the identifier.

For `OSType` keyspaces, the key will be returned as a `CFNumber`, where a big endian interpretation of its <doc://com.apple.documentation/documentation/CoreFoundation/CFNumberType/sInt32Type> value represents the four bytes of the key’s numeric value.

For the keyspaces [`kCMMetadataKeySpace_QuickTimeMetadata`](/documentation/CoreMedia/kCMMetadataKeySpace_QuickTimeMetadata) and [`kCMMetadataKeySpace_Icy`](/documentation/CoreMedia/kCMMetadataKeySpace_Icy), the key will be returned as a `CFString`.

All other keyspaces will have the function return the key as a `CFData`.

---

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)