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

前端之家收集整理的这篇文章主要介绍了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

原文链接:https://www.f2er.com/iOS/334014.html

猜你在找的iOS相关文章