检查用户的Spotify库中是否存在歌曲

时间:2018-06-02 20:54:29

标签: ios swift sdk spotify

使用以下代码检查用户的库是否包含特定歌曲。它返回一个错误。我能做错什么?我无法找到这个特殊的例子,因为我们已经找到了解决问题的方法。方法无处不在。

let accessToken = SPTAuth.defaultInstance().sessionUserDefaultsKey
let request: URLRequest = try! 
SPTYourMusic.createRequest(forCheckingIfSavedTracksContains: ["spotify:track:3ZakaL0QEt5eeD3N7HbaN1"], forUserWithAccessToken: accessToken)
SPTRequest.sharedHandler().perform(request) { (error, response, data) in
    if error == nil {
        print ("this is data\(String(describing: data))")
    } else {
        print ("error")
    }
} 

错误是:

  

错误域= NSURLErrorDomain代码= -1012"(null)" UserInfo = {NSErrorFailingURLStringKey = api.spotify.com / v1 / me / tracks / contains?ids =,NSUnderlyingError = 0x109e7eb60 {Error Domain = kCFErrorDomainCFNetwork Code = -1012"(null)" UserInfo = {_ kCFURLErrorAuthFailedResponseKey =< CFURLResponse 0x109e7e970 [0x1b441e538]> {url = api.spotify.com/v1/me/tracks/contains?ids=}}},NSErrorFailingURLKey = api.spotify.com / v1 / me / tracks /包含?IDS =}

0 个答案:

没有答案