ios – Spotify SDK缺少令牌刷新服务?

我试图避免每次会话在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)
            }
    })

}

任何解决方案?

解决方法

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

[SPTAuth defaultInstance] .tokenSwapURL = [NSURL URLWithString:@“swapURL”];
[SPTAuth defaultInstance] .tokenRefreshURL = [NSURL URLWithString:@“refreshURL”];

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

还有一个SPTAuth类的参考:

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

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...