Определить, когда нажата «назад в приложение»

Я создал функцию, которая должна обрабатывать разрешение с местоположением, чтобы приложение закрывалось, если у него нет разрешения на местоположение. Однако, когда вы нажимаете открытые настройки и нажимаете «назад к приложению» в строке состояния,determeinePermission метод не выполняется снова. Я пытался добавить его вviewDidLoad, viewDidAppear а такжеviewWillAppear, А что я могу сделать?

func determinePermission() {
    switch CLLocationManager.authorizationStatus() {

    case .Authorized:
        if CLLocationManager.locationServicesEnabled() {
            manager.delegate = self
            manager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
            manager.startUpdatingLocation()
        }


    case .NotDetermined:
        manager.requestWhenInUseAuthorization()
    case .AuthorizedWhenInUse, .Restricted, .Denied:
        let alertController = UIAlertController(
            title: "Background Location Access Disabled",
            message: "In order to be notified about adorable kittens near you, please open this app's settings and set location access to 'Always'.",
            preferredStyle: .Alert)

        let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel) { (action) in
            exit(0)
        }
        alertController.addAction(cancelAction)

        let openAction = UIAlertAction(title: "Open Settings", style: .Default) { (action) in
            if let url = NSURL(string:UIApplicationOpenSettingsURLString) {
                UIApplication.sharedApplication().openURL(url)
            }
        }
        alertController.addAction(openAction)

        self.presentViewController(alertController, animated: true, completion: nil)
    }
}

Ответы на вопрос(1)

Ваш ответ на вопрос