为了避免发泄任何我可能有我很想知道这里周围的人已经使用(代码段明智)在其应用程序中播放短小音频效果?现在我正在严格处理iOS 5 ARC项目,我之前的方法被禁止并引发错误。播放短音频效果
那么,如何才能在iOS 5和Objective-C的应用程序中简单播放一个小的1秒音频文件呢?
感谢任何积极贡献的人!
编辑:下面是发送带有ARC错误和iOS 5
NSString *soundPath=[[NSBundle mainBundle] pathForResource:@"swoosh" ofType:@"caf"];
SystemSoundID sound;
AudioServicesCreateSystemSoundID((__bridge_retained CFURLRef)[NSURL fileURLWithPath:soundPath],&sound);
AudioServicesPlaySystemSound(sound);
代码为您的以前的方法,请! – ZhangChn 2012-01-31 16:12:46
NSString * soundPath = [[NSBundle mainBundle] pathForResource:@“swoosh”ofType:@“caf”]; SystemSoundID声音; 声音;音频服务创建系统声音ID((__ bridge_retained CFURLRef)[NSURL fileURLWithPath:soundPath],&sound); AudioServicesPlaySystemSound(sound); – Brayden 2012-01-31 16:39:12