An object that responds to remote command events.


@interface MPRemoteCommand : NSObject


The Media Player framework defines a standard set of MPRemoteCommand objects for handling media-related events. When an accessory or iOS user interface generates a remote control event, the system notifies the corresponding command object on the shared MPRemoteCommandCenter instance. That command object executes any attached handlers.

To respond to a particular event, register a handler with the appropriate MPRemoteCommand object.

Listing 1

Registering a remote control event handler

// Get the shared command center.
MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter];

// Add a handler for the play command.
[commandCenter.playCommand addTargetWithHandler:^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent * _Nonnull event) {
    if (self.player.rate == 0.0) {
        [self.player play];
        return MPRemoteCommandHandlerStatusSuccess;
    return MPRemoteCommandHandlerStatusCommandFailed;

If you explicitly don’t want to enable a given command, fetch the command object and set its enabled property to NO. Disabling a remote command lets the system know that it shouldn’t display any related UI for that command when your app is the Now Playing app.

The framework defines many subclasses to handle specific kinds of commands. Sometimes, these subclasses let you specify other information related to the command. For example, feedback commands let you specify a localized string that describes the meaning of the feedback. When supporting a particular command, be sure to look up the specific class used to handle those events.


Handling Events

- addTargetWithHandler:

Adds a block to be called when an event is received.

- addTarget:action:

Adds a target object to be called when an event is received.

- removeTarget:

Removes a target from the remote command object.

- removeTarget:action:

Removes a target and action from a remote command object.


Constants indicating the status of a command.

Enabling a Command Object


A Boolean value that indicates whether a user can interact with the displayed element.


Inherits From

See Also

Setting up the Remote Event Handler

Becoming a Now Playable App

Ensure your app is eligible to become the “Now Playing” app by adopting best practices for providing Now Playing Info and registering for Remote Command Center actions.


An object that responds to remote control events sent by external accessories and system controls.


A description of a command sent by an external media player.