0

I created a simple spritekit game. It works and sounds great in the simulator and on my iPad2. The game runs fine on my daughters iPhone 6 but the background music and sound effects don't work. There are no errors. I checked the volume on the phone even playing some music in iTunes to make sure I could hear it.

Sound declarations: located just after the my custom class definition

let tickglass = SKAction.playSoundFileNamed("tickglass.wav", waitForCompletion: false)
let backgroundMusic = SKAudioNode(fileNamed: "peterpiperb.wav")

Locate in playGame function:

backgroundMusic.autoplayLooped = true
addChild(backgroundMusic)

Sound effect when user touches the screen:

runAction(tickglass)

All sounds are 44.1 kHz wav files store in a Sounds sub folder. I'm running Xcode 7.3, and iOS 9.3.5. and OS X 10.11.4

Keep in mind that I'm not new to programming but I am new to Xcode programming.

Thanks for your help!

Alessandro Ornano
  • 34,887
  • 11
  • 106
  • 133
ScottW
  • 35
  • 7

1 Answers1

1

Well, one obvious idea is making sure your iPad has sound on. You would be surprised at the times stuff like that happens. Also make sure you has system sounds on in your systems. This post might have some additional help.

Community
  • 1
  • 1
coder
  • 26
  • 5
  • The game sounds work on my iPad and in the simulator. The only place it doesn't work is on the phone. I checked the sound levels on the phone even playing some music from iTunes to ensure it was working. – ScottW Sep 08 '16 at 04:06
  • http://stackoverflow.com/questions/7411467/why-does-audio-work-in-the-simulator-but-not-on-my-ipad?noredirect=1&lq=1 – coder Sep 08 '16 at 13:36
  • The problem is fixed but I can't definitively say what fixed it. I went to Settings>Sound on the phone and noticed that the Ringer and Alerts were turned all the way up. I exited setting and then pulled the menu up form the bottom of the home screen. The volume slider there was about 3/4. I slid it to 100%. I then clicked the speaker icon on the left to see if it would mute but it did not. I exited the menu and played the game and the sound worked. Although here'swhatiknow's link didn't specifically hold the answer it was what inspired me to try what I did so I marked it as the answer. – ScottW Sep 08 '16 at 23:10
  • glad you got the answer! I hate when stuff like that happens – coder Sep 09 '16 at 01:11