ios - MPMediaQuery not returning any results when filtered with MPMediaPropertyPredicate -
i'm working on building ios music player , reason, whenever try , pull in of songs in given album display them in table view query comes empty. i've tried running query songs on device, , works fine, reason when try , filter media predicate nothing returned:
// pull playing song's album mpmediaitem *currentsong = [self.store currentlyplayingsong]; nsstring *album = [currentsong valueforproperty:mpmediaitempropertyalbumtitle]; // begin filtering album title mpmediapropertypredicate *albumpredicate = [mpmediapropertypredicate predicatewithvalue:album forproperty:mpmediaitempropertyartist comparisontype:mpmediapredicatecomparisonequalto]; nsset *albumset = [nsset setwithobject:albumpredicate]; mpmediaquery *albumquery = [[mpmediaquery alloc] initwithfilterpredicates:albumset]; nsarray *albumsongs = [albumquery items]; nslog(@"album songs: %@", [albumquery items]);
basically, want pull album title playing song , use filter. i've been trying use this post guide, can't seem combination of proposed solutions work.
just solved it...i stupidly enough had made typo hadn't noticed. pulling in album name, filtering artist...
Comments
Post a Comment