I'm using Spotify playback in my iOS app.
I'm using the Spotify iOS SDK, following the pattern shown in NowPlayingView. Everything works correctly at first:
- Authorization flow completes
- Remote playback starts via SPTAppRemote
- App correctly receives playback state and metadata
🐞Problem:
After I pause playback, if I wait a few seconds, I consistently receive a disconnection callback from the SDK:
func appRemote(_ appRemote: SPTAppRemote, didDisconnectWithError error: Error)
This happens even while the app is fully active and foregrounded — not backgrounded, killed, or suspended.
Here is the actual debug output:
[SpotifyManager] 🔴 appRemote disconnected with error:
• Description: Connection terminated.
• Code: -1002
• Domain: com.spotify.app-remote
• Failure Reason: The Spotify app might have been suspended.
• Recovery Suggestion: Try to reconnect.
• Underlying Error: End of stream.
• Underlying Failure Reason: One of the streams has reached the end.
• Underlying Recovery Suggestion: Reconnect to the Spotify app.
What I’ve Verified:
- The Spotify app is open and active (not backgrounded or closed)
- My app is also in foreground
- Network is stable, no major background tasks running
- I am not calling disconnect() manually
- Valid Access Token
💥Impact
After this disconnection, I cannot control playback anymore.
To restore control, the user must go through the full authorisation and reconnection flow again, which results in a disrupted and unintuitive user experience.
Please let us know:
- Is there a recommended way to prevent this disconnection after pause?
- How can we recover control without forcing full re-authentication?
This issue is blocking us from delivering a stable and seamless playback experience to users.
Any clarification or workaround would be greatly appreciated.