Search code examples
iosswiftswift2avcapturedevice

Does AVCaptureDevice.requestAccessForMediaType only work for undetermined authorization status?


I am checking if an app has permission to use the camera with:

let authStatus = AVCaptureDevice.authorizationStatusForMediaType(AVMediaTypeVideo)

If the authorization status is denied (perhaps the user accidentally did not allow permission the first time when asked), is it possible to show the permission request again?

If authorization has been denied, I am attempting to request permission with:

AVCaptureDevice.requestAccessForMediaType(AVMediaTypeVideo,
                                      completionHandler: { (granted:Bool) -> Void in
    if granted {
        dispatch_async(dispatch_get_main_queue()) {
            self.shootPhoto(UIButton())
        }
    }
})

But no request for permission is dialog is presented. Does requestAccessForMediaType only work if the authorization status is undetermined?


Solution

  • No this is not possible. In this situation, you will need to explain to the user how to go into Settings and change the permissions.