Jonathan
Jonathan

Reputation: 1

How to get all my playlists with SoundCloud API

I'm using the iOS SDK provided by SoundCloud. My issue is the following : i can't get my playlists. Indeed, there a few weeks, everything was working properly but now my jsonResponse object is nil. Here is an excerpt of my code :

//Get soundcloud account to launch request
SCAccount *account = [SCSoundCloud account];
SCRequestResponseHandler handler;
handler = ^(NSURLResponse *response, NSData *data, NSError *error) {
    NSError *jsonError = nil;
    NSJSONSerialization *jsonResponse = [NSJSONSerialization
                                         JSONObjectWithData:data
                                         options:0
                                         error:&jsonError];
    if (!jsonError && [jsonResponse isKindOfClass:[NSArray class]]) {
        //response treatment
    }

NSString *resourceURL = @"https://api.soundcloud.com/me/playlists.json";
[SCRequest performMethod:SCRequestMethodGET
              onResource:[NSURL URLWithString:resourceURL]
         usingParameters:nil
             withAccount:account
  sendingProgressHandler:nil
         responseHandler:handler];

I don't understand because the two following requests return results:

  1. /Me (about my soundcloud account)

NSString *resourceURL = @"https://api.soundcloud.com/me.json";
Request with this URL return an NSDictionary which contains some informations such as the number of playlists (return 61 playlists)

  1. /Tracks (get tracks)

NSString *resourceURL = @"https://api.soundcloud.com/me/tracks.json"; Request with this URL return an NSArray which contains some informations about my tracks

So, i am wondering if the url to get all playlists of my account with soundcloud api would not have changed ? Thank you in advance for your answers.

Upvotes: 0

Views: 561

Answers (1)

Andrés Brun
Andrés Brun

Reputation: 185

Since SoundCloud decided not to maintain anymore this library I created my own one, maybe it could helps you. One of the request I've already implemented is request your playlists:

[self.soundCloudPort requestPlaylistsWithSuccess:^(NSArray *playLists) {
    // Here you have your playlists
} failure:^(NSError *error) {
    // Handle the error
}];

ABMSoundCloud on Github

Upvotes: 1

Related Questions