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
}