【问题标题】:How to get all my playlists with SoundCloud API如何使用 SoundCloud API 获取我的所有播放列表
【发布时间】:2015-03-09 15:04:24
【问题描述】:

我使用的是 SoundCloud 提供的 iOS SDK。我的问题如下:我无法获取我的播放列表。确实,有几个星期,一切正常,但现在我的 jsonResponse 对象为零。 这是我的代码的摘录:

//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];

我不明白,因为以下两个请求返回结果:

  1. /我(关于我的 soundcloud 帐户)

NSString *resourceURL = @"https://api.soundcloud.com/me.json";
使用此 URL 的请求返回一个 NSDictionary,其中包含一些信息,例如播放列表的数量(返回 61 个播放列表)

  1. /Tracks(获取曲目)

NSString *resourceURL = @"https://api.soundcloud.com/me/tracks.json"; 使用此 URL 的请求返回一个 NSArray,其中包含有关我的曲目的一些信息

所以,我想知道使用 soundcloud api 获取我帐户的所有播放列表的 url 是否不会改变? 预先感谢您的回答。

【问题讨论】:

    标签: ios objective-c json soundcloud


    【解决方案1】:

    自从 SoundCloud 决定不再维护这个库以来,我创建了自己的库,也许它可以帮助你。我已经实现的请求之一是请求您的播放列表:

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

    ABMSoundCloud on Github

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-12
      相关资源
      最近更新 更多