Search code examples
xcodeipadios4avaudioplayerios-simulator

Why does audio work in the simulator but not on my iPad?


I am working on creating a very simple app. 2 buttons, both play sound. Each clip lasts 1 second and responds to "TouchUpInside". They are .caf files that I converted in iTunes.

Here is my code, once again, it works in the simulator but not on the device:

enter code here- (void)viewDidLoad {

    NSLog(@"InView did load");

AudioServicesCreateSystemSoundID ((CFURLRef)[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"bigaif" ofType:@"caf"]], &systemSoundID);


    AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:[[NSBundle mainBundle] 
                                                                   pathForResource: @"smallwav" ofType:@"wav"]],                                                            
                                                                    &systemSoundIDTwo);

}

-(IBAction) playSound:(id) sender {
AudioServicesPlaySystemSound(systemSoundID);
}

-(IBAction) playSoundTwo:(id) sender {
AudioServicesPlaySystemSound(systemSoundIDTwo);

}


Solution

  • I found my answer. I was using SystemSound and what do you know, I had my system sounds muted in my device settings.