View Full Version : Playing Sound with Startup Image?

May 9, 2011, 10:44 PM
I'm working on an app, and while it's essentially finished, I'd really like to add in a startup image and a sound to play with it.

I know how to add the launch image, but what do I need to do to have the sound file play when the app is launched?

May 10, 2011, 02:53 AM
applicationDidFinishLaunching -->

NSString *path = [NSString stringWithFormat:@"%@%@",
[[NSBundle mainBundle] resourcePath],

//declare a system sound id
SystemSoundID soundID;

//Get a URL for the sound file
NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];

//Use audio sevices to create the sound
AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);

//Use audio services to play the sound

got that from first google search.

Probably have to add a framework.

May 10, 2011, 02:24 PM
Awesome - thanks. I knew how to play the audio, but didn't know where to stick the code for it to get it to play with the launch image.