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

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...