Question

I need to send an SPTrack to another device via an Bonjour connection. But the bonjour library I am using(DTBonjour) requires an encodeWithCoder implementation to send objects across a network. But it seems like SPTrack does not include the NSCoding implementation, so I don't want to mess around in the spotify library, my question is: Can I somehow create a NSData object from SPTrack without SPTrack implementing NSCoding?

thanks in advance

Was it helpful?

Solution

Spotify tracks aren't really suited to be directly sent between processes like this - they represent a track from the perspective of a logged-in user and contain a lot of state.

Instead, you should take the spotifyURL of the track and transmit that. In your other process, use [SPTrack trackForTrackURL: …] to recreate a valid SPTrack instance.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top