Apple开发_播放自定义音效
-
代码
// 引入音频管理文件 #import <AVFoundation/AVFoundation.h> // 播放扫描二维码的声音 SystemSoundID soundID; NSString *strSoundFile = [[NSBundle mainBundle] pathForResource:@"noticeMusic" ofType:@"wav"]; AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:strSoundFile], &soundID); AudioServicesPlaySystemSound(soundID);