【发布时间】:2017-09-19 19:25:51
【问题描述】:
我正在检查应用是否有权使用相机:
let authStatus = AVCaptureDevice.authorizationStatusForMediaType(AVMediaTypeVideo)
如果授权状态被拒绝(可能是用户第一次被询问时不小心没有允许),是否可以再次显示权限请求?
如果授权被拒绝,我正在尝试通过以下方式请求许可:
AVCaptureDevice.requestAccessForMediaType(AVMediaTypeVideo,
completionHandler: { (granted:Bool) -> Void in
if granted {
dispatch_async(dispatch_get_main_queue()) {
self.shootPhoto(UIButton())
}
}
})
但是没有出现权限请求对话框。 requestAccessForMediaType是否只有在授权状态未确定时才有效?
【问题讨论】:
标签: ios swift swift2 avcapturedevice