---
title: "CMMetadataCreateKeyFromIdentifier(allocator:identifier:keyOut:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmmetadatacreatekeyfromidentifier(allocator:identifier:keyout:)"
---

# CMMetadataCreateKeyFromIdentifier(allocator:identifier:keyOut:)

Creates a copy of the key by using an identifier.

## Declaration

```swift
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

Return Value If successful, a nonzero result code. See Metadata Identifier Error Codes.

## Discussion

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 CFNumberType.sInt32Type value represents the four bytes of the key’s numeric value. For the keyspaces kCMMetadataKeySpace_QuickTimeMetadata and kCMMetadataKeySpace_Icy, the key will be returned as a CFString. All other keyspaces will have the function return the key as a CFData.

## See Also

### Creating Metadata Identifiers

- [CMMetadataCreateIdentifierForKeyAndKeySpace(allocator:key:keySpace:identifierOut:)](coremedia/cmmetadatacreateidentifierforkeyandkeyspace(allocator:key:keyspace:identifierout:).md)
- [CMMetadataCreateKeyFromIdentifierAsCFData(allocator:identifier:keyOut:)](coremedia/cmmetadatacreatekeyfromidentifierascfdata(allocator:identifier:keyout:).md)
- [CMMetadataCreateKeySpaceFromIdentifier(allocator:identifier:keySpaceOut:)](coremedia/cmmetadatacreatekeyspacefromidentifier(allocator:identifier:keyspaceout:).md)
