I followed Chris’s tutorial on how to make a simple soundboard. I modified the instructions to produce my own custom app. I was able to get the app to work on my phone, but the sounds only play if I have my iPhone’s side switch turned on. So it’s playing the sounds as if they are ringtones/alert sounds. How can I change this, so it plays the sound EVEN with the iPhone’s switch turned on to silent mode?
Hi @nellakcin Welcome to the community
Try this:
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback)
} catch(let error) {
print(error.localizedDescription)
}
That is an interesting question, let me know how it goes.
Blessings,
—Mark
Thanks for the reply Mark. Should I place this under each IBAction for each button? Or where should I put this code?
I placed the code you wrote out into my first button to test it out. It worked on that button AND all 8 other buttons that worked!
THANKS MARK!!
After further testing, the rest of the buttons only worked after I pressed the first button.
Placing this code within every Buttons IBAction allowed it to work. Thanks again Mark!