iOS Developer Library

Developer

MediaPlayer Framework Reference MPFeedbackCommand Class Reference

Options
Deployment Target:

On This Page
Language:

MPFeedbackCommand

Inherits From


Conforms To


Import Statement


Swift

import MediaPlayer

Objective-C

@import MediaPlayer;

Availability


Available in iOS 7.1 and later

An MPFeedbackCommand object reflects the state of feedback for what your app is currently playing. The shared MPRemoteCommandCenter object vends feedback objects for liking, disliking, and bookmarking media items. Use these objects to register handlers for the types of feedback your app supports and to perform the appropriate tasks when that feedback changes. When the currently playing item changes, you can also use this object to set the feedback state for the new item.

When the state of a feedback item changes, the system delivers an appropriate event to registered handlers of this object. Your handler code must determine which media item receives the feedback and then apply the update the feedback state for that item. You might also perform other tasks related to receiving feedback. For example, if the user likes the currently playing song, you might update the appropriate UI in your app or use the information to recommend similar songs.

  • active active Property

    A Boolean value that indicates whether the feedback’s action is on or off.

    Declaration

    Swift

    var active: Bool

    Objective-C

    @property(nonatomic, assign, getter=isActive) BOOL active

    Discussion

    Use this property to get or set the current state of the given feedback. An example of an active feedback command is a Like button that has been enabled by the user. In that scenario, toggling the button on and off would similarly toggle the value in this property.

    Import Statement

    Objective-C

    @import MediaPlayer;

    Swift

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later

  • A localized string used to describe the context of a command.

    Declaration

    Swift

    var localizedTitle: String!

    Objective-C

    @property(nonatomic, copy) NSString *localizedTitle

    Discussion

    Use this property to store the text you want shown to the user in conjunction with this command. For example, you might assign the string “I like this” to this property for the command associated with a Like button. The text you specify is displayed to the user at appropriate times by the system.

    Import Statement

    Objective-C

    @import MediaPlayer;

    Swift

    import MediaPlayer

    Availability

    Available in iOS 7.1 and later

  • A shortened version of the string used to describe the context of a command.

    Declaration

    Swift

    var localizedShortTitle: String!

    Objective-C

    @property(nonatomic, copy) NSString *localizedShortTitle

    Discussion

    Use this property to provide information about a feedback command that is suitable for display when screen space is more constrained. For example, Apple Watch uses this string instead of the string in the localizedTitle property.

    Import Statement

    Objective-C

    @import MediaPlayer;

    Swift

    import MediaPlayer

    Availability

    Available in iOS 8.0 and later