参考链接:
居然是同时播放一个与拍照声相反的声音,中和掉拍照声。
if (soundID == 0) {
NSString *path = [[NSBundle mainBundle] pathForResource:@"photoShutter2" ofType:@"caf"];
NSURL *filePath = [NSURL fileURLWithPath:path];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)filePath, &soundID);
}
AudioServicesPlaySystemSound(soundID);
这段代码写在
[self.ImageOutPut captureStillImageAsynchronouslyFromConnection
前面。
下载photoShutter2.caf的地址参考
http://www.cocoachina.com/bbs/read.php?tid-1681579-toread-1-page-1.html
题外话~
运行时在
NSURL *filePath = [NSURL fileURLWithPath:path];
崩溃掉了,原来是path=nil。原因是我导入photoShutter2.caf时忘了添加到工程下面。

解决办法除了重新导入,简单的就是把photoShutter2.caf添加到Copy BundleResources中。

网友评论