I'm trying to create a built-in Spotify link into my music sharing application. One similar to Shazam which after tapped, takes the user to the track in the Spotify app. I am using the iTunes API to retrieve JSON data and decode the songs into NSDictionary types, but I can't figure out how to load a Spotify link using the NSDictionary type of the song.
The NSDictionary is created here:
NSDictionary *songData = self.tableData[indexPath.row];
This is where I try to generate a Spotify link:
NSError *error = nil;
SPTPartialTrack *songSpotifyTrack = [[SPTPartialTrack alloc] initWithDecodedJSONObject: songData error: &error];
NSLog(@"THE SPOTIFY URI IS %@", songSpotifyTrack.previewURL);
The output is: THE SPOTIFY URI IS (null)
Can someone please point out the error in my code? Thanks.
SPTPartialTrack has another variable called uri.