spencra spencra - 1 year ago 116
iOS Question

Let other apps play background music

I would like to add the functionality for other apps, such as Pandora or iTunes, to continue playing music while my Sprite Kit game is open.

How would I go about doing this? I apologize for the somewhat broadness of this question, I just can't find a lot of information on this.

Answer Source

Set your AVAudioSession category to Ambient.

import AVFoundation

    do {
        try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient)
        try AVAudioSession.sharedInstance().setActive(true)
    catch let error as NSError {

AVAudioSession Class Reference

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download