I am implementing AudioToolbox framework into my ipad app to try to play a sound effect. Here is my code: I declared a SystemSoundID called explode
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)
}
But for some reason the sou开发者_如何学Cnd never plays.
try passing the address of explode
AudioServicesCreateSystemSoundID((CFURLRef)explodeURL, &explode);
精彩评论