簡體   English   中英

removeTracksFromPlaylist不使用iOS Spotify SDK刪除曲目

[英]removeTracksFromPlaylist not removing tracks with ios spotify sdk

我正在測試此方法以從播放列表中刪除曲目。 基本上,我修改了SDK隨附的演示項目“簡單軌道回放”。 當您點擊fastForward時,我想從播放列表中刪除曲目。 我以這種方式更改了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

我通過重置模擬器+添加SPTAuthPlaylistModifyPublicScope解決了我的問題(我可以這樣做...)

auth.requestedScopes = @[SPTAuthStreamingScope, SPTAuthPlaylistModifyPublicScope];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM