2012-05-23 54 views
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; 
      } 
     }]; 
    }]; 
} 
+0

嗨馬特橋樑你解決了這個錯誤? – Tendulkar

回答

0

藝術家瀏覽應該不會影響任何東西 - 一個軌道的軌道。但是,如果您可以可靠地複製它,請分叉CocoaLibSpotify併爲單元測試套件添加一個失敗的單元測試 - 這樣我們就可以修復它。

也可能Spotify播放服務在錯誤的時間不可用,但這種情況相當少見。

相關問題