2012-12-01 49 views
0

我必須從iTunes下載iTunes音樂商店中的特定曲目點擊我的應用程序。我無法準確找到如何執行此操作。如何從iTunes Store下載特定曲目xcode

我已經實現了下面的代碼在播放列表中獲取播放列表和歌曲:

-(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); 
    } 
} 

現在我希望讓應用程式下載按鈕點擊一個特定的軌道。我怎樣才能做到這一點?

+0

我已經實現了以下代碼來獲取播放列表中的播放列表和歌曲 – Himanshu

+2

代碼和您的問題之間的關係是什麼? – miho

回答