Spotify SDK缺少令牌刷新服务?

时间:2017-09-10 10:47:42

标签: ios session swift3 spotify

我试图避免每次会话在Spotify for SDK中过期时用户的弹出窗口授予权限。

Pop出现一小时后,弹出窗口似乎再次授予用户权限,这样他就可以在我的应用程序上播放Spotify中的曲目,我在尝试续订会话时遇到错误:

[PLAYER][PLAY][SPOTIFY] Error renew Session Optional(Error Domain=com.spotify.auth Code=0 "Missing token refresh service." UserInfo={NSLocalizedDescription=Missing token refresh service.})
[PLAYER][SPOTIFY] Session could not be renewed,popup login

以及我如何尝试更新会话:

//Renew Session
func renewSession(completion:@escaping (Bool)->())
{
    print("[PLAYER][PLAY][SPOTIFY] Renew Session requested ")

    let auth = SPTAuth.defaultInstance()
        auth?.renewSession(auth?.session, callback: { (error, session) in

            if (error != nil)
            {
                print("[PLAYER][PLAY][SPOTIFY] Error renew Session \(String(describing: error))")
                completion(false)
                return
            }

            auth?.session = session

            if auth?.session.isValid() == true
            {
                print("[PLAYER][PLAY][SPOTIFY] Renew Session Success")
                completion(true)
            }else
            {
                print("[PLAYER][PLAY][SPOTIFY] Renew Session Failed")
                completion(false)
            }
    })

}

任何解决方案吗?

1 个答案:

答案 0 :(得分:1)

您是否在SPTAuth对象上分配了这些属性?

_CRT SEGMENT PUBLIC DWORD ALIAS('.CRT$XLD') DD OFFSET my_tls_callback _CRT ENDS

取自https://github.com/spotify/ios-sdk/issues/427,如果这还不够,可能会有更多信息。

还有SPTAuth类的参考:

https://spotify.github.io/ios-sdk/Classes/SPTAuth.html