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

Benjamin Bell
Benjamin Bell
4,364 Points

Audio file (.mp3) using the AudioServicesPlaySystemSound function does not work. Help?

I tried playing the .mp3 sound file using the AudioServicesPlaySystemSound function as per the video tutorial. This did not work and just created a lag in the animation. Upon further reading of the relevant documentation, it turns out that the following restrictions apply to the AudioServicesPlaySystemSound function:

  • No longer than 30 seconds in duration -In linear PCM or IMA4 (IMA/ADPCM) format -Packaged in a .caf, .aif, or .wav file

Unless I am missing something the .mp3 sound file used in the tutorial should not have worked. Has apple recently changed the formats supported by this function? (what am I missing here?)

Update: Interestingly it works when deployed on my iPhone but not in the simulator.

Benjamin Bell
Benjamin Bell
4,364 Points

Cleaning the project does it. Thanks for the link.