Can't hear CAF Audio in running app

I have an unusual situation. I'm working through some self study training and this particular project is a game similar to fruit ninja where things are flying around the screen and you slice through them by swiping your finger. Anyway the instructor provided a series of "*.caf" files for various sounds while playing the game. For some reason I can't hear any of the sounds on my personal Mac when running the app via Xcode to either an iOS iPad simulator or to a real iPad that I have attached to my mac and setup for developer use in Xcode.

Yes sound is working on the mac (hear new email come in etc. and can play videos in the browser).

In the iPad simulator I can play youtube videos in mobile safari. While adjusting the sound doesn't seem to raise or lower the volume I can hear the audio in the youtube videos.

On the real iPad: yes the sound is on and I can hear audio while playing videos in the browser etc.

Lastly, I pushed the code up to GitHub and pulled it to my work Mac. There the sound plays just find in the iOS iPad simulator on that Mac (not allowed to attach my personal iPad to my work mac so can't try the iPad there). So I fell like this confirms the code is correct for playing the sounds in the running app.

Oh, and I can select the file in left nav and click the little play button icon to hear it played in Xcode.

so, I feel like this is an issue on my personal Mac with Xcode etc., but I'm at a loss as to what the issue is. Can anyone suggest some things to look for on my Mac to get sound working in this app?

if you want to see the code it's here and the free training i'm following is at https://www.hackingwithswift.com/100/77.

TIA

I added

do {
                try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback)
            } catch  {
                print("could not set session. err:\(error.localizedDescription)")
            }
            do {
                try AVAudioSession.sharedInstance().setActive(true)
            } catch {
                print("could not active session. err:\(error.localizedDescription)")
            }

to the main UIViewController

... that caused audio to start working on a real device. Didn't have any effect on the simulators though. Not sure why I didn't need that AVAudioSession code on my work Mac either.

regarding your comment regarding why you might need AVAudioSession. I have some code which ran and produced audio without that call. Later the call was added so that the mixer could be used to fade in the audio. ie. the AVAudioSession mixer causes the audio to come from volume 0 to full volume over a time period.

Can't hear CAF Audio in running app
 
 
Q