2

I am able to play the music in background while playing the candy Crush Saga App in iPhone along with the sound of the game. But in case of my app, music stops playing. How can My app play sounds along with the music in the background?

Developer
  • 6,375
  • 12
  • 58
  • 92

1 Answers1

3

-[AVAudiosession setCategory:error:] contains the ancient secrets you seek.

Read the documentation — some categories will allow mixing of sounds from other applications, from the background of your application, or when your application is backgrounded. Others won't.

(What you probably want is [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];, but reading the docs will tell you for sure.

buildsucceeded
  • 4,203
  • 4
  • 34
  • 72