嗨,我需要播放 iTunes 库中的歌曲。我浏览了 Apples ipod Library Access Guide 并获得了代码。
MPMediaQuery *everything = [[MPMediaQuery alloc] init];
NSLog(@"Logging items from a generic query...");
NSArray *itemsFromGenericQuery = [everything items];
MPMediaItem *song;
for (song in itemsFromGenericQuery)
{
NSString *songTitle = [song valueForProperty: MPMediaItemPropertyTitle];
NSLog (@"%@", songTitle);
}
//assign a playback queue containing all media items on the device
[myPlayer setQueueWithQuery:everything];//setQueueWithQuery:everything];
//start playing from the begining
[myPlayer play];
但这将从库列表的最开始播放。当我从列表中选择一首歌时,我需要播放它。任何人都可以帮助我吗...
谢谢,世斌。