0

How can we prevent the view from going to the previous view after user clicks OK button on camera access prompt? Here is our code:

func RequestCameraAccess() {
    AVCaptureDevice.requestAccess(forMediaType: AVMediaTypeVideo, completionHandler: { (granted: Bool) -> Void in
        if granted == true {
            print("User Granted")
            DispatchQueue.main.async {
                self.Cam();
            }
        } else {
            print("User Rejected")
            DispatchQueue.main.async {
                self.image1.isHidden = true
            }

        }
    })
}

Thanks

1 Answers1

1

the problem was that in the moment of camera access granting the following method occurs:

func applicationDidBecomeActive(_ application: UIApplication) {}

In my application I had logic to move to home screen in case of inactivity for a certain amount of time.

Thanks anyway.