【发布时间】: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];
我不明白,因为以下两个请求返回结果:
- /我(关于我的 soundcloud 帐户)
NSString *resourceURL = @"https://api.soundcloud.com/me.json";
使用此 URL 的请求返回一个 NSDictionary,其中包含一些信息,例如播放列表的数量(返回 61 个播放列表)
- /Tracks(获取曲目)
NSString *resourceURL = @"https://api.soundcloud.com/me/tracks.json"; 使用此 URL 的请求返回一个 NSArray,其中包含有关我的曲目的一些信息
所以,我想知道使用 soundcloud api 获取我帐户的所有播放列表的 url 是否不会改变? 预先感谢您的回答。
【问题讨论】:
标签: ios objective-c json soundcloud