2
我試圖從使用cocoalibspotify的SPArtistBrowse的結果播放頂級曲目。這個最完美的作品,但有時我得到以下錯誤的時間:嘗試播放某些曲目時出現cocoalibspotify錯誤
Error Domain=com.spotify.CocoaLibSpotify.error Code=3 "The track cannot be played"
這僅發生於特定的曲目,併爲受影響的軌跡是一致的和可重複的(如阿明凡布倫頂軌,Spotify的:track:6q0f0zpByDs4Zk0heXZ3cO,嘗試使用下面的代碼播放時總是出現此錯誤)。奇怪的是,如果我使用簡單的播放器示例應用程序並輸入受影響的曲目的URL,則曲目會正常播放;所以我的預感是它與從SPArtistBrowse加載的曲目有關。
這裏是我使用的播放曲目代碼:
- (void)playTrack
{
SPTrack *track = [self.artistBrowse.topTracks objectAtIndex:self.currentTrackIndex];
[SPAsyncLoading waitUntilLoaded:track then:^(NSArray *tracks) {
[self.playbackManager playTrack:track callback:^(NSError *error) {
if (error) {
self.currentTrackIndex++;
if (self.currentTrackIndex < self.artistBrowse.topTracks.count) {
[self playTrack];
} else {
[self.activityIndicator stopAnimating];
self.activityIndicator.alpha = 0;
self.nowPlayingLabel.text = @"Spotify Error";
}
} else {
[self.activityIndicator stopAnimating];
self.activityIndicator.alpha = 0;
self.nowPlayingLabel.text = track.name;
// Set "Now Playing" info on the iOS remote control
MPNowPlayingInfoCenter *infoCenter = [MPNowPlayingInfoCenter defaultCenter];
NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
[dic setValue:track.name forKey:MPMediaItemPropertyTitle];
[dic setValue:self.artistLabel.text forKey:MPMediaItemPropertyArtist];
infoCenter.nowPlayingInfo = dic;
}
}];
}];
}
嗨馬特橋樑你解決了這個錯誤? – Tendulkar