Apple开发_播放自定义音效

  • 代码

    // 引入音频管理文件
    #import <AVFoundation/AVFoundation.h>
    
    // 播放扫描二维码的声音
    SystemSoundID soundID;
    NSString *strSoundFile = [[NSBundle mainBundle] pathForResource:@"noticeMusic" ofType:@"wav"];
    AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:strSoundFile], &soundID);
    AudioServicesPlaySystemSound(soundID);
    
posted @ 2018-07-01 14:29  CH520  阅读(1465)  评论(0编辑  收藏  举报