Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Simple iPhone App (iOS7) Animating and Intercepting Events Adding Sound

John Akin
John Akin
2,253 Points

I followed the lesson and double checked my code. The sound will not play on the simulator.

The sounds plays on the phone, but I won’t play in the simulator. I get no errors and I confirmed that the simulator can play sound (by loading up a web video). What’s the issue here?

Can you please post your code? Thanks!

4 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

If it works on the device then it should work on the simulator. You could try cleaning the project or resetting the simulator. To clean your project, use the keyboard shortcut Shift+Command+K or from the menu Product -> Clean. To reset the simulator from the simulator's menu select iOS Simulator -> Reset Content and Settings.

Cody Girdlestone
Cody Girdlestone
4,358 Points

I'm getting the same problem as John. I have triple checked my code and can't see anything being wrong ...

Edit: My code seems to be fine, I have signed up to the Apple Developer program and this seems to be an issue with iOS Simulator as it worked straight away on my iPhone.

Aman Tohan
Aman Tohan
14,822 Points

I am noticing that Instead of using the AudioServicesPlaySystemSound(soundEffect);, using the AudioServicesPlayAlertSound(soundEffect); is playing the sound through the iOS Simulator. Also playing the sound using AudioServicesPlayAlertSound(soundEffect); will make the phone vibrate too.

Another interesting thing I'm noticing is that on the iPhone the sound plays through the Ringer channel for either of these lines of code. Is it possible to get the sound playing through the other sound channel on the phone?

I've tried cleaning the project, reseting the IOS simulator, and tried using AudioServicesPlayAlertSound (soundEffect) alternatively...all didn't work. I even check the sound preferences on my mac...Play userinterface is ticked..

why isn't the simulator working.?