-1

I am developing an app that has a recording feature.
I know that the authorization status is not determined when a user is asked for the access request for the first time. Once the user has been asked for camera access (This is when the user chooses whether to authorize or deny), the authorization status can not get back to the default status (Status == .notDetermined).

Is there a way to get the default status (status == .notDetermined) for the sake of testing?

switch AVCaptureDevice.authorizationStatus(for: .video) {
case .authorized: // The user has previously granted access to the camera.
    self.setupCaptureSession()

case .notDetermined: 
// The user has not yet been asked for camera access.
// Once the user has been asked for camera access, this will never be executed again. 
    AVCaptureDevice.requestAccess(for: .video) { granted in
        if granted {
            self.setupCaptureSession()
        }
    }

case .denied: // The user has previously denied access.
    return

case .restricted: // The user can't grant access due to restrictions.
    return
}
akaakoz
  • 248
  • 6
  • 16

1 Answers1

-3

Uninstall the already existing app and try reinstalling a fresh build after a day to get .notDetermined status for AVCaptureDevice.authorizationStatus. You can't reset the permission programmatically. You could also reset permission by resetting the device, which seems a bit harsh. In summary, there are 2 ways to do this:

  1. Reset the OS
  2. Uninstall the app and wait for a day
Frankenstein
  • 15,732
  • 4
  • 22
  • 47