KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am testing my app on my 3GS iPhone with iOS 4.2 I am using the following code which plays a sound in my IBAction. It works perfectly in the simulator (both iPad and iPhone) - I hear the sound. NSString *pathToMusicFile1 = [[NSBundle mainBundle] pathForResource:@"alarm" ofType:@"mp3"]; NSError *error; alarmSound = [[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL fileURLWithPath:pathToMusicFile1] error:&error]; NSLog(@"Song1 Loaded"); if (alarmSound == nil) { NSLog(@"Error playing sound"); } else { alarmSound.numberOfLoops = 20; alarmSound.volume = 1.0; [alarmSound play]; } I have everything declared properly (headers and frameworks etc) as I can hear the sound in the simulator. I have also checked that my phone is NOT in silent mode!! I hear other sounds from the generic iphone GUI. (example from a datepicker). I have also cleaned all targets and deleted the app to reinstall. Any ideas what's wrong?!
Tags (comma-separated)
Save Edits
Cancel