Objective c 音频工具箱问题
我正在我的ipad应用程序中实现AudioToolbox框架,以尝试播放声音效果。这是我的代码:我声明了一个名为explode的SystemSoundIDObjective c 音频工具箱问题,objective-c,xcode,ipad,audiotoolbox,Objective C,Xcode,Ipad,Audiotoolbox,我正在我的ipad应用程序中实现AudioToolbox框架,以尝试播放声音效果。这是我的代码:我声明了一个名为explode的SystemSoundID NSURL *explodeURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Explosion" ofType:@"wav"]]; AudioServicesCreateSystemSoundID((__
NSURL *explodeURL = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"Explosion" ofType:@"wav"]];
AudioServicesCreateSystemSoundID((__bridge CFURLRef) explodeURL, explode);
[self performSelector:@selector(playsfx) withObject:nil afterDelay:2.0];
-(void)playsfx {
AudioServicesPlaySystemSoundID(explode)
}
但是由于某些原因,声音永远不会播放。尝试传递爆炸的地址
AudioServicesCreateSystemSoundID((CFURLRef)explodeURL, &explode);