I'm trying to play a sound but it's not working.
I don't get any errors and the app runs fine but just no audio plays. The console shows this with my logs:
ssid is showing up as null? Any help is appreciated!
Code:
if (sound == @"Song Name") {
UIImage *image = [UIImage imageNamed: @"picture.png"];
lyrics = [[UIImageView alloc] initWithImage: image];
[self.view addSubview:lyrics];
// Create pathname to sound file
NSString *sndPath = [[NSBundle mainBundle]
pathForResource:@"song"
ofType:@"aif"
inDirectory:@"/"];
// Create URL
CFURLRef sndURL = (CFURLRef)[[NSURL alloc]
initFileURLWithPath:sndPath];
// Create system sound ID
AudioServicesCreateSystemSoundID(sndURL, &ssid);
NSLog(@"%@\n", sndURL);
NSLog(@"%@\n", ssid);
AudioServicesPlaySystemSound(ssid);
}
I don't get any errors and the app runs fine but just no audio plays. The console shows this with my logs:
Code:
2009-02-16 10:01:39.407 Program[1370:20b] file://localhost/Users/username/Library/Application%20Support/iPhone%20Simulator/User/Applications/37D00767-4E08-4DCB-BA37-99B5BCBE2DC1/Program.app///song.aif
2009-02-16 10:01:39.408 Program[1370:20b] (null)
ssid is showing up as null? Any help is appreciated!