在iOS 7上检查麦克风权限而不显示提示

3
我在iOS 7上找到的唯一记录的检查麦克风权限的方法是requestRecordPermission,该方法记录在AVAudioSession中。https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/Reference/Reference.html#//apple_ref/occ/instm/AVAudioSession/requestRecordPermission:
然而,使用此方法检查权限的行为将显示一个提示框,要求用户授权,如果用户还没有做出决定,这可能非常不可取。是否有一种方法可以检查麦克风权限而不显示提示框?
1个回答

7

iOS 8中,AVAudioSession新增了一个属性:

[AVAudioSession sharedInstance].recordPermission

这将返回一个AVAudioSessionRecordPermission

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

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


1
看起来在iOS 7和8上都有一种方法可以检查这个:https://dev59.com/V18f5IYBdhLWcg3wJf0H#31161351 - Matt Cooper

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接