【问题标题】:Check for mic permission on iOS 7 without showing prompt在不显示提示的情况下检查 iOS 7 上的麦克风权限
【发布时间】:2013-10-27 05:53:33
【问题描述】:

我能找到的在 iOS 7 上检查麦克风权限的唯一记录方法是 requestRecordPermission,记录在 AVAudioSession 上。 https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/Reference/Reference.html#//apple_ref/occ/instm/AVAudioSession/requestRecordPermission:

但是,如果用户尚未做出决定,则使用此方法检查权限的行为会显示一个警告,要求用户获得权限,这可能是非常不可取的。有没有办法在不显示提示的情况下检查麦克风权限?

【问题讨论】:

    标签: permissions ios7 microphone avaudiosession


    【解决方案1】:

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

    [AVAudioSession sharedInstance].recordPermission
    

    返回一个AVAudioSessionRecordPermission:

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

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

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-08
    相关资源
    最近更新 更多