AudioServicesPlaySystemSound(soundID);
}
//销毁音效
+(void)disposeSound:(NSString *)filename
{
//如果传入的文件名为空,那么就直接返回
if (!filename) return;
//1.取出对应的音效
SystemSoundID soundID=[[self soundIDs][filename] unsignedIntegerValue];
//2.销毁
if (soundID) {
AudioServicesDisposeSystemSoundID(soundID);
//2.1销毁后,从字典中移除
[[self soundIDs]removeObjectForKey:filename];
}
}
@end
代码测试:
代码说明:
打印的值为0,播放成功(因为函数是C++中的)
注:相关教程知识阅读请移步到IOS开发频道。












