Search code examples
iosobjective-cplaylistitunes-apiiosdeployment

Make local playlist with songs from iTunes


Is there any chance to search iTunes for songs and add them to the local playlist programmatically?

BTW: I created local playlist successfully and got JSON but I don't know how to use it:

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://itunes.apple.com/search?term=Gipsy+Kings+Bamboleo&country=US&media=music&entity=song"]];
[[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error){
    NSError *jsonError;
    NSDictionary *jsonResult = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&jsonError];
}] resume];

Solution

  • Users configure playlists using iTunes on the desktop or by creating an on-the-go playlist on the device. To your iOS application, (MPMediaPlaylist) playlists are read-only. so there is currently no way to create these through a 3rd-party app. The user can only do this with iTunes or through the built-in iOS Music app.

    Apple Ref Link

    Hope this will help you.