本文介绍了检查iOS 7上的麦克风权限,但不显示提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iOS 7上检查mic权限的唯一记录方法是 requestRecordPermission 记录在 AVAudioSession 上。 :

The only documented method for checking mic permission on iOS 7 that I could find is requestRecordPermission documented on AVAudioSession. https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/Reference/Reference.html#//apple_ref/occ/instm/AVAudioSession/requestRecordPermission:

但是,如果用户尚未做出决定,则使用此方法检查权限的行为将显示警告,要求用户获得许可,这可能是非常不受欢迎的。是否有工作来检查麦克风权限而不显示提示?

However, the very act of checking permission using this method will display an alert asking user for permission if user hasn't already made a decision, which can be very undesirable. Is there a work around to check mic permission without showing a prompt?

推荐答案

在iOS 8中,他们为AVAudioSession添加了一个新属性:

In iOS 8, they added a new property to AVAudioSession:

[AVAudioSession sharedInstance].recordPermission

返回 AVAudioSessionRecordPermission

enum {
   AVAudioSessionRecordPermissionUndetermined     = 'undt',
   AVAudioSessionRecordPermissionDenied           = 'deny',
   AVAudioSessionRecordPermissionGranted          = 'grnt'
};
typedef NSUInteger  AVAudioSessionRecordPermission;

但在iOS 7中似乎没有办法。

But there doesn't seem to be a way in iOS 7.

这篇关于检查iOS 7上的麦克风权限,但不显示提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-28 04:24