为什么音频在模拟器中工作但在我的iPad上没有?

Jos*_*shD 3 xcode avaudioplayer ipad ios4 ios-simulator

我正在创建一个非常简单的应用程序.2个按钮,都播放声音.每个剪辑持续1秒钟并响应"TouchUpInside".它们是我在iTunes中转换的.caf文件.

这是我的代码,再次,它在模拟器中工作,但不在设备上:

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);
Run Code Online (Sandbox Code Playgroud)

}

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

-(IBAction) playSoundTwo:(id) sender {
AudioServicesPlaySystemSound(systemSoundIDTwo);
Run Code Online (Sandbox Code Playgroud)

}

Gro*_*oot 11

在我的代码中查找过去30分钟的错误后,我发现iPad侧面的静音按钮已打开.在尝试一些奇特的解决方案之前检查一下

花了30分钟......