English 中文(简体)
试图播放某些音轨时, cocoblipize 错误
原标题:cocoalibspotify error when attempting to play certain tracks

我试图用可可校正点来播放SPARTistBrowse的顶部音轨。 大部分时候,这效果是完美无缺的, 但我偶尔会犯以下错误:

Error Domain=com.spotify.CocoaLibSpotify.error Code=3 "The track cannot be played"

这只适用于特定的音轨,而对于受影响的音轨,它具有一致性和可重复性(例如Armin van Buren的顶级音轨, 定位: track: 6q0f0zpByDs4Zk0heXZ3cO, 试图使用下面的代码播放时总是出此错误 ) 。 奇怪的是, 如果我使用简单的玩家样本应用程序并输入受影响的音轨的 URL, 轨迹就会很好; 因此我的直觉是它和从SPArtic Brrowse 上装入的音轨有关。

以下是我用来玩曲子的代码:

- (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;
            }
        }];
    }];
}
问题回答

艺术家浏览应该影响任何事物- 音轨是一个音轨。 但是, 如果您可以可靠地复制它, 请在单位测试套件中添加一个失败的单位测试, 这样我们就可以修复它 。

同样有可能的是,《点点》播放服务在错误的时间是不可用的,但这种情况相当少见。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签