iOS Developer Library

Developer

MediaPlayer Framework Reference MPMediaPropertyPredicate Class Reference

Options
Deployment Target:

On This Page
Language:

MPMediaPropertyPredicate

Use one or more MPMediaPropertyPredicate objects, or media property predicates, to define the filter in a media query to retrieve a subset of media items from the iPod library. A predicate in this context is a statement of a logical condition that you want to test each media item against. Those items that satisfy the condition are retrieved in the query result.

You define iPod library queries, and retrieve query results, using the MPMediaQuery class, described in MPMediaQuery Class Reference. The media items and media item collections that you retrieve with a query are described in MPMediaItem Class Reference and MPMediaItemCollection Class Reference.

Inheritance


Import Statement


Swift

import MediaPlayer

Objective-C

@import MediaPlayer;

Availability


Available in iOS 3.0 and later.
  • property property Property

    The property that the media property predicate uses when you invoke a query.

    Declaration

    Swift

    var property: String! { get }

    Objective-C

    @property(nonatomic, readonly, copy) NSString *property

    Import Statement

    Objective-C

    @import MediaPlayer;

    Swift

    import MediaPlayer

    Availability

    Available in iOS 3.0 and later.

  • value value Property

    The value that the media property predicate matches against when you invoke a query.

    Declaration

    Swift

    @NSCopying var value: AnyObject! { get }

    Objective-C

    @property(nonatomic, readonly, copy) id value

    Import Statement

    Objective-C

    @import MediaPlayer;

    Swift

    import MediaPlayer

    Availability

    Available in iOS 3.0 and later.

  • The type of matching comparison that the media property predicate performs when you invoke a query.

    Declaration

    Swift

    var comparisonType: MPMediaPredicateComparison { get }

    Objective-C

    @property(nonatomic, readonly) MPMediaPredicateComparison comparisonType

    Discussion

    For comparison types, see Media Property Predicate Comparison Types.

    Import Statement

    Objective-C

    @import MediaPlayer;

    Swift

    import MediaPlayer

    Availability

    Available in iOS 3.0 and later.

  • Logical comparison types for media queries.

    Declaration

    Swift

    enum MPMediaPredicateComparison : Int { case EqualTo case Contains }

    Objective-C

    enum { MPMediaPredicateComparisonEqualTo, MPMediaPredicateComparisonContains }; typedef NSInteger MPMediaPredicateComparison;

    Constants

    • EqualTo

      MPMediaPredicateComparisonEqualTo

      Matches when a media item’s value for a given property is equal to the value in the media property predicate.

      Available in iOS 3.0 and later.

    • Contains

      MPMediaPredicateComparisonContains

      Matches when a media item’s value for a given property is contained in the value of the media property predicate.

      Available in iOS 3.0 and later.

    Import Statement

    Objective-C

    @import MediaPlayer;

    Swift

    import MediaPlayer

    Availability

    Available in iOS 3.0 and later.