现在的位置: 首页 > 综合 > 正文

检测iphone 是不是震动模式 并播放音频文件

2018年02月14日 ⁄ 综合 ⁄ 共 489字 ⁄ 字号 评论关闭

检测iphone 是不是震动模式 并播放音频文件

                   if (![AVAudioSessionPortHeadsetMic isEqualToString:[[AVAudioSession sharedInstance] category]] && ![RecorderManager sharedManager].isRecording)
                       {
                           SystemSoundID soundToPlay;
                            NSString *path  = [[NSBundle mainBundle] pathForResource:@"messagein" ofType:@"caf"];
                            NSURL *pathURL = [NSURL fileURLWithPath : path];
                            AudioServicesCreateSystemSoundID((__bridge CFURLRef) pathURL, &soundToPlay);
                            //playback
                            AudioServicesPlaySystemSound(soundToPlay);
                        }else
                        {
                        AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
            
                      }
【上篇】
【下篇】

抱歉!评论已关闭.