Question about MPMusicPlayerController
Question about MPMusicPlayerController
- Subject: Question about MPMusicPlayerController
- From: "Eric E. Dolecki" <email@hidden>
- Date: Fri, 8 Oct 2010 11:12:03 -0400
I have an app I am playing around with to play my music on my Touch. When I
select a genre that is in a table, I construct a query to get all the tracks
for that genre, start that queue, build UI in a scrollview.
However if I choose a Genre like "Rock" that is available and has a lot of
tracks in it, my app crashes. Works for less-populated genres. Am I doing
something really stupid here?
In my -tableView:didSelectRowAtIndexPath
MPMediaQuery *query = [[MPMediaQuery alloc] init];
[query addFilterPredicate:[MPMediaPropertyPredicate
predicateWithValue:[liveGenresArray
objectAtIndex:indexPath.row]
forProperty:MPMediaItemPropertyGenre]];
NSArray *songs = [query items];
if([songs count]>0){
selectedNowPlayingRow = 0;
[myPlayer setQueueWithQuery:query];
[nowPlayingSongs removeAllObjects];
for(MPMediaItem *song in songs){
NSString *songTitle = [song
valueForProperty:MPMediaItemPropertyTitle];
[nowPlayingSongs addObject:songTitle];
}
songTitleLabel.text = [nowPlayingSongs objectAtIndex:0];
[self updateNowPlayingScroller:query];
[myPlayer play];
[query release]
///...
Google Voice: (508) 656-0622
Twitter: eric_dolecki XBoxLive: edolecki PSN: eric_dolecki
http://blog.ericd.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden