---
title: "removeTarget(_:action:)"
framework: mediaplayer
role: symbol
role_heading: Instance Method
path: "mediaplayer/mpremotecommand/removetarget(_:action:)"
---

# removeTarget(_:action:)

Removes a target and action from a remote command object.

## Declaration

```swift
func removeTarget(_ target: Any, action: Selector?)
```

## Parameters

- `target`: The object that currently is a recipient of action messages sent by this object. Specify nil to remove all targets.
- `action`: A selector identifying a method on the target. Specify NULL to remove all actions.

## Discussion

Discussion Call the removeTarget(_:action:) method to remove the specified target-action pair. Passing nil for target matches all targets and passing NULL for action matches all actions.

## See Also

### Handling events

- [addTarget(handler:)](mediaplayer/mpremotecommand/addtarget(handler:).md)
- [addTarget(_:action:)](mediaplayer/mpremotecommand/addtarget(_:action:).md)
- [removeTarget(_:)](mediaplayer/mpremotecommand/removetarget(_:).md)
- [MPRemoteCommandHandlerStatus](mediaplayer/mpremotecommandhandlerstatus.md)
