# How to play sound effects on iOS?

I have a game that plays sounds when some events occur.

Currently, I am using AVAudioPlayer for the purpose of playing the sound. But just the bare AVAudioPlayer has a noticeable lag time before the first playback and it stops music played by other apps.

Also, it stops the ongoing playback when a new playback is ordered. Surely, I could use a list of AVAudioPlayers for each of the effects, but that feels clunky.

I want something that will play effects mixed, one on top of another; and I want them to be played on top of background music, if there is any. I do not use any sorts of frameworks, like SpriteKit or Unity. So, how do I do this?

You have to change your AVAudioSession to Category rather than the default (Solo).
[[AVAudioSession sharedInstance]setCategory:AVAudioSessionCategoryAmbient error:nil]; should do the trick.