ios - 在 Spotify iOS 应用程序中创建播放列表

标签 ios spotify

我正在使用 spotify api 创建播放列表。

我可以通过以下代码获取播放列表列表:-

[SPTRequest playlistsForUserInSession:session callback:^(NSError *error, SPTListPage *list){
            if (error != nil) {
                UIAlertView *view = [[UIAlertView alloc] initWithTitle:@"Getting User Info Failed"
                                                               message:error.userInfo[NSLocalizedDescriptionKey]
                                                              delegate:nil
                                                     cancelButtonTitle:@"OK"
                                                     otherButtonTitles:nil];
                [view show];
                return;
            }


            NSLog(@"list==>%@",list.items);

        }];

但我发现有下面的函数用于创建带有名称的播放列表。 类名是 SPTPlaylistList 但我不知道如何使用下面的功能。请帮助我。

-(void)createPlaylistWithName:(NSString *)name publicFlag:(BOOL)isPublic session:(SPTSession *)session callback:(SPTPlaylistCreationCallback)block;

最佳答案

playlistsForUserInSession: 返回一个 SPTPlaylistList 对象,而不是一个 SPTListPage。将您的调用更改为如下所示,您会没事的:

[SPTRequest playlistsForUserInSession:session callback:^(NSError *error, SPTPlaylistList *list) {

    ...
}];

这在库随附的文档和标题中。事实上,如果您 Alt+单击代码中的 playlistsForUserInSession: 方法,您会看到一个小弹出窗口,告诉您您获得了一个 SPTPlaylistList 返回。阅读文档将为您节省大量时间!

关于ios - 在 Spotify iOS 应用程序中创建播放列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28514534/

相关文章:

c# - 如何从 C# 调用 Spotify API

javascript - Spotify 应用程序 API : any more documentation?

ios - 通知服务扩展中的 Gif 崩溃

ios - Swift - 检测正在播放的音乐,无论是 Spotify 还是 iTunes

c# - Libspotify 播放问题

iphone - 如何测试生产推送通知?

Spotify Web API 客户端范围不起作用

ios - 自定义 UITableViewCell 不可见,我的第一个自定义单元格可见,其他不可见

ios - 无法提交 iOS 应用程序以供审核 - "There are one or more errors on the page."

ios - 不同 View Controller 中的 NSFetchedResultsController 相互更新?