Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Can't filter MPMediaQuery to show only music (crazy parameter error)

$
0
0

Hello,

I'm trying to use MPMediaQuery to filter by MPMediaType.Music (and others predicates but this is the only one causing problems):

MPMediaQuery mq = new MPMediaQuery ();
mq.AddFilterPredicate (MPMediaPropertyPredicate.PredicateWithValue (MPMediaType.Music, MPMediaItemProperty.MediaType));

With this code I get the following error:

Error CS1502: The best overloaded method match for MonoTouch.MediaPlayer.MPMediaPropertyPredicate.PredicateWithValue(MonoTouch.Foundation.NSObject, string) has some invalid arguments (CS1502) Error CS1503: Argument `#1' cannot convert MonoTouch.MediaPlayer.MPMediaType' expression to type MonoTouch.Foundation.NSObject (CS1503)

I'm using Xamarin.iOS 6.3 from the Beta channel.

Just to compare this is the equivalent Objective-C code that I use and works:

MPMediaQuery *mq = [[MPMediaQuery alloc] init];
[mq addFilterPredicate:[MPMediaPropertyPredicate predicateWithValue:@(MPMediaTypeMusic) forProperty:MPMediaItemPropertyMediaType]];

How can I solve this?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>