我必须从我的应用程序的 Button Click 上从 iTunes 音乐商店下载特定曲目。我无法准确找到如何执行此操作。
我已经实现了以下代码来获取播放列表中的播放列表和歌曲:
-(void)musicPlaylist{
playlistQuery= [MPMediaQuery playlistsQuery];
NSArray *arr = [playlistQuery collections];
NSLog(@"Playlist is : %@",arr);
int count1=[arr count];
NSLog(@" count 1 is %d",count1);
for (MPMediaPlaylist *playlist in arr) {
NSLog (@"%@", [playlist valueForProperty: MPMediaPlaylistPropertyName]);
playlistTitle = [playlist valueForProperty: MPMediaPlaylistPropertyName];
playlistDict=[NSDictionary dictionaryWithObjectsAndKeys:playlistTitle,@"playlist Title",nil];
[dictArray addObject:playlistDict];
NSArray *songs = [playlist items];
for (MPMediaItem *song in songs) {
NSString *songTitle =[song valueForProperty: MPMediaItemPropertyTitle];
[songArray addObject:songTitle];
}
NSLog(@"Playlist is %@",playlistTitle);
NSLog(@"Playlist Songs are %@",songArray);
}
}
现在我想允许应用程序在按钮单击时下载特定曲目。我怎样才能做到这一点?