2014-07-07 82 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