尝试创建新的播放列表,但它不起作用。
请求功能:
-(NSURLRequest *)makeNewPlaylistsRequestNamed:(NSString *)name
{
NSURL *url = [NSURL URLWithString:@"https://api.soundcloud.com/playlists"];
NSURLComponents *comp = [NSURLComponents componentsWithURL:url
resolvingAgainstBaseURL:YES];
NSMutableArray *qi = [[NSMutableArray alloc] init];
[qi addObject:[NSURLQueryItem queryItemWithName:@"oauth_token" value:self.authResult.value]];
comp.queryItems = qi;
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:comp.URL];
request.HTTPMethod = @"PUT";
NSDictionary *newPL = @{@"title":name,@"sharing":@"public",@"tracks":@[]};
NSDictionary *gistDict = @{@"playlist":newPL};
NSError *jsonError;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:gistDict
options:NSJSONWritingPrettyPrinted
error:&jsonError];
[request setHTTPBody:jsonData];
return request;
}
但新的播放列表不会创建。 我使用了网络API - https://developers.soundcloud.com/docs/api/reference#playlists