2014-07-07 40 views
0

我的应用程序使用麦克风录制语音。我如何检测(来自Monotouch代码)是否启用了设置中的麦克风(设置 - 隐私 - 麦克风)。MonoTouch检测iPhone上是否启用麦克风

用户可以转到设置并禁用麦克风。如果是这样,那么我想提醒用户启用麦克风。

回答

1
AVAudioSession newsession = AVAudioSession.SharedInstance; 

newsession.RequestRecordPermission(delegate(bool granted) { 
    // if granted is true you have access, otherwise you can display 
    // a message to the user asking them to enable the mic 
}); 
+0

AVAudioSession newsession = new AVAudioSession();在最新的iOS版本中已经过时。 – User382

+0

看到我上面的编辑 – Jason