Skip to content

Instantly share code, notes, and snippets.

@codeswimmer
Created January 2, 2013 19:57
Show Gist options
  • Select an option

  • Save codeswimmer/4437399 to your computer and use it in GitHub Desktop.

Select an option

Save codeswimmer/4437399 to your computer and use it in GitHub Desktop.
iOS: How to play sounds
SystemSoundID soundID;
id sndpath = [[NSBundle mainBundle] pathForResource:@"mySound" ofType:@"mp3" inDirectory:@"/"];
CFURLRef baseURL = (CFURLRef) [[NSURL alloc] initFileURLWithPath:sndpath];
AudioServicesCreateSystemSoundID (baseURL, &soundID);
AudioServicesPlaySystemSound(soundID);
[baseURL release];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment