I followed the SimplePlayer example project while integrating it in my own test project. Logging in and searching for tracks already works perfectly, but when I try to play a song like SimplePlayer it crashes after 1-2 seconds of playback with EXC_BAD_ACCESS
on two different locations in SPSession.m
(see picture below). Here is the code that starts playback:
SPTrack *track = [allTracks objectAtIndex:currentTrack];
[SPAsyncLoading waitUntilLoaded:track timeout:kSPAsyncLoadingDefaultTimeout then:^(NSArray *loadedItems, NSArray *notLoadedItems) {
[playbackManager playTrack:track callback:^(NSError *error) {
if (error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Can't play Spotify Track" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
} else {
spotifyTrack = track;
}
}];
}];
Note: I handle the playback of the songs in a custom class SpotifyPlayer
via Singleton pattern.
Any help would be greatly appreciated!