ios-sdk
ios-sdk copied to clipboard
AppRemote tries "Connecting..." but does not and gives no further feedback
I am trying to connect to Spotify using this code
lazy var player: SPTAppRemote = {
let remote = SPTAppRemote(
configuration: config,
logLevel: .debug
)
remote.delegate = self
return remote
}()
and then after initiating session manager:
player.connectionParameters.accessToken = accessToken
SPTAppRemote.checkIfSpotifyAppIsActive { [weak self] isActive in
if isActive {
self?.player.connect()
} else {
self?.player.authorizeAndPlayURI("")
}
}
Since I have Spotify app playing in the background, I'm landing on player.connect() line when debugging with breakpoints. However, all I get in the Xcode console is AppRemote: Connecting... and no further feedback. The delegate method appRemoteDidEstablishConnection(_ appRemote: SPTAppRemote) is not called either, even though set in the lazy initializer as in the snippet above.
Is there any way I could further debug this issue?
Thank you for your help
Didn't happen later so I'm closing this
Unfortunately, it happened a few times for me later. I also had a situation where AppRemote did log AppRemote: Established a session with the Spotify app. but did not log authentication anywhere and did not call any delegate callback. This happened via connect() route. It seems to work fine with authorizeAndPlayURI so far, so it seems I will have to remove the connect() path for now until this is fixed.
This issue happened at some times and sometimes it didn't, I could not determine what was the cause and why sometimes it seemed to work and another time it just did not.
2 years later still having the same problem... any ideas anyone?
For some reason this started working - had to mark everything with @objc