Ios AUIOClient_StartIO在后台播放歌曲时失败

Ios AUIOClient_StartIO在后台播放歌曲时失败,ios,iphone,ios8,spotify,avaudiosession,Ios,Iphone,Ios8,Spotify,Avaudiosession,我已经使用Spotify iOS SDK作为流媒体服务来播放音乐。因为我必须处理应用程序中的中断,所以我集成了音频会话 请查找下面的代码 AVAudioSession *session = [AVAudioSession sharedInstance]; NSError *audioSessionError = nil; [session setCategory: AVAudioSessionCategoryPlayAndRecord error: &aud

我已经使用Spotify iOS SDK作为流媒体服务来播放音乐。因为我必须处理应用程序中的中断,所以我集成了音频会话

请查找下面的代码

AVAudioSession *session = [AVAudioSession sharedInstance];
NSError *audioSessionError = nil;
[session setCategory: AVAudioSessionCategoryPlayAndRecord
               error: &audioSessionError];

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(audioSessionInterruptionNotification:)
                                             name:AVAudioSessionInterruptionNotification
                                           object:session];

-(void)audioSessionInterruptionNotification:(NSNotification*)notification {

//Check the type of notification, especially if you are sending multiple AVAudioSession events here
NSLog(@"Interruption notification name %@", notification.name);

if ([notification.name isEqualToString:AVAudioSessionInterruptionNotification]) {
    seccReason = @"Interruption notification received";

    //Check to see if it was a Begin interruption
    if ([[notification.userInfo valueForKey:AVAudioSessionInterruptionTypeKey] isEqualToNumber:[NSNumber numberWithInt:AVAudioSessionInterruptionTypeBegan]]) {
        NSLog(@"Interruption began");

    } else if([[notification.userInfo valueForKey:AVAudioSessionInterruptionTypeKey] isEqualToNumber:[NSNumber numberWithInt:AVAudioSessionInterruptionTypeEnded]]){
        NSLog(@"Interruption ended!");
        //Resume your audio
    }
  }
}
在后台测试应用程序时,我遇到了一个问题“AUIOClient\u StartIO失败”,因此我在谷歌上搜索,发现它可能与AVAudioSession类别有关,因此,我已将其从AVAudioSessionCategoryAmbient更改为AVAudioSessionCategoryPlayAndRecord,但我仍然得到了这个问题


请指导我应该做些什么来实现它。

你有没有想过这个问题?