CocoaLibSpotify playback crashes after a few seconds

守給你的承諾、 提交于 2019-12-13 02:48:34

问题


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!


回答1:


I'm assuming SimplePlayer doesn't crash in the same way. That code shows that you're either over-releasing your SPSession instance, or that the object you set as the session's delegate has been released without the delegate being set to nil. Double check your memory management and object lifetimes.



来源:https://stackoverflow.com/questions/20416747/cocoalibspotify-playback-crashes-after-a-few-seconds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!