【问题标题】:removeTracksFromPlaylist not removing tracks with ios spotify sdkremoveTracksFromPlaylist 不使用 ios spotify sdk 删除曲目
【发布时间】:2015-06-02 21:47:33
【问题描述】:

我正在测试此方法以从播放列表中删除曲目。基本上我修改了SDK提供的演示项目“简单曲目播放”。当您点击快进时,我想从播放列表中删除曲目。我以这种方式更改了 fastForward 方法,但它什么也没做,并且错误为零。

-(IBAction)fastForward:(id)sender {
    if([self.player isPlaying] && self.currentPlaylistSnapshot){
        SPTAuth *auth = [SPTAuth defaultInstance];
        [self.currentPlaylistSnapshot removeTracksFromPlaylist:@[self.player.currentTrackURI]
                                    withAccessToken:auth.session.accessToken
                                    callback:^(NSError *error) {
                                        if (error != nil) {
                                            NSLog(@"*** Failed to remove track : %@", self.titleLabel.text);
                                            return;
                                        }
                                    }];
    }

    [self.player skipNext:nil];
}

self.currentPlaylistSnapshot 是我从handleNewSession 方法中得到的。

还有一个静态方法显然提供了类似的东西,我还没有尝试过。

createRequestForRemovingTracks:fromPlaylist:withAccessToken:snapshot:error:

根据文档,这两个选项都是异步实现的,需要几秒钟的时间才能在服务器中反映结果,但我怀疑可能有问题,或者我只是错过了执行实际请求以将更改推送到可能是本地快照?

文档: https://developer.spotify.com/ios-sdk-docs/Documents/Classes/SPTPlaylistSnapshot.html#//api/name/removeTracksWithPositionsFromPlaylist:withAccessToken:callback:

ios SDK: https://github.com/spotify/ios-sdk

【问题讨论】:

    标签: ios objective-c spotify playlist


    【解决方案1】:

    我通过重置模拟器 + 添加 SPTAuthPlaylistModifyPublicScope 解决了我的问题(我不想这样做...)

    auth.requestedScopes = @[SPTAuthStreamingScope, SPTAuthPlaylistModifyPublicScope];
    

    【讨论】:

      猜你喜欢
      • 2019-09-23
      • 2016-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-22
      • 1970-01-01
      相关资源
      最近更新 更多