---
title: "CMCopyDictionaryOfAttachments(allocator:target:attachmentMode:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmcopydictionaryofattachments(allocator:target:attachmentmode:)"
---

# CMCopyDictionaryOfAttachments(allocator:target:attachmentMode:)

Returns a dictionary of all attachments for an attachment bearer object.

## Declaration

```swift
func CMCopyDictionaryOfAttachments(allocator: CFAllocator?, target: CMAttachmentBearer, attachmentMode: CMAttachmentMode) -> sending CFDictionary?
```

## Parameters

- `allocator`: Allocator for the new dictionary; pass doc://com.apple.documentation/documentation/CoreFoundation/kCFAllocatorDefault or NULL to use the default allocator.
- `target`: Specifies the doc://com.apple.coremedia/documentation/CoreMedia/CMAttachmentBearer whose attachments you want to obtain.
- `attachmentMode`: The mode of the attachments you want to obtain. See doc://com.apple.coremedia/documentation/CoreMedia/CMAttachmentMode for possible values.

## Return Value

Return Value A Core Foundation dictionary with all attachments identified by their keys. If no attachment is present, the dictionary is empty. Returns NULL for an invalid attachment mode.

## Discussion

Discussion CMCopyDictionaryOfAttachments is a convenience call that returns all attachments with their corresponding keys in a new CFDictionary. Given a CVBufferRef, CMCopyDictionaryOfAttachments is similar to CVBufferGetAttachments, except that the CFDictionary that CMCopyDictionaryOfAttachments returns isn’t updated for later changes to the attachments.

## See Also

### Processing Attachments

- [CMGetAttachment(_:key:attachmentModeOut:)](coremedia/cmgetattachment(_:key:attachmentmodeout:).md)
- [CMSetAttachment(_:key:value:attachmentMode:)](coremedia/cmsetattachment(_:key:value:attachmentmode:).md)
- [CMSetAttachments(_:attachments:attachmentMode:)](coremedia/cmsetattachments(_:attachments:attachmentmode:).md)
- [CMRemoveAttachment(_:key:)](coremedia/cmremoveattachment(_:key:).md)
- [CMRemoveAllAttachments(_:)](coremedia/cmremoveallattachments(_:).md)
- [CMPropagateAttachments(_:destination:)](coremedia/cmpropagateattachments(_:destination:).md)
