四、麦克风权限(iOS8.0后)
首先需要导入框架#import <AVFoundation/AVFoundation.h>
,并且在info.plist中配置好NSMicrophoneUsageDescription
字段
- 授权状态的获取
先获取[AVAudioSession sharedInstance]
的单例对象,根据实例方法recordPermission
获得当前App的麦克风授权状态,该状态是个枚举
typedef NS_ENUM(NSUInteger, AVAudioSessionRecordPermission)
{
AVAudioSessionRecordPermissionUndetermined = 'undt', // 待定
AVAudioSessionRecordPermissionDenied = 'deny', // 拒绝
AVAudioSessionRecordPermissionGranted = 'grnt' // 允许
}
当枚举类型是AVAudioSessionRecordPermissionUndetermined
的时候,通过单