---
title: "CMRemoveAttachment(_:key:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmremoveattachment(_:key:)"
---

# CMRemoveAttachment(_:key:)

Removes a specific attachment from an attachment bearer object.

## Declaration

```swift
func CMRemoveAttachment(_ target: CMAttachmentBearer, key: CFString)
```

## Parameters

- `target`: The CMAttachmentBearer containing the attachment to remove.
- `key`: Key in the form of a Core Foundation string identifying the desired attachment.

## Discussion

Discussion If the attachment exists, the function removes the attachment and decrements the retain count. Given a CVBuffer, CMRemoveAttachment is equivalent to CVBufferRemoveAttachment.

## See Also

### Processing Attachments

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