File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ class ViewController: UIViewController {
7171 askForPermissionsLabel. isHidden = false
7272 } else if currentCameraState == . ready {
7373 addCameraToView ( )
74+ } else {
75+ askForPermissionsLabel. isHidden = false
7476 }
7577
7678 flashModeImageView. image = UIImage ( named: " flash_off " )
@@ -194,10 +196,17 @@ class ViewController: UIViewController {
194196 @IBAction func askForCameraPermissions( ) {
195197
196198 self . cameraManager. askUserForCameraPermission ( { permissionGranted in
197- self . askForPermissionsLabel. isHidden = true
198- self . askForPermissionsLabel. alpha = 0
199+
199200 if permissionGranted {
201+ self . askForPermissionsLabel. isHidden = true
202+ self . askForPermissionsLabel. alpha = 0
200203 self . addCameraToView ( )
204+ } else {
205+ if #available( iOS 10 . 0 , * ) {
206+ UIApplication . shared. open ( URL ( string: UIApplicationOpenSettingsURLString) !)
207+ } else {
208+ // Fallback on earlier versions
209+ }
201210 }
202211 } )
203212 }
You can’t perform that action at this time.
0 commit comments