I am using the instance method requestWhenInUseAuthorization()
of the CLLocationManager
class to force the alert message Turn On Location Services to Allow "myApp" to Determine Your Location
to appear a second time after the user selects Cancel
on its first appearance but the alert message does not appear a second time. Can anyone explain where I am going wrong in my code? Thanks.
I have the code below in one custom sub-class of UITableViewController
;
if (CLLocationManager.locationServicesEnabled() == false) || (CLLocationManager.authorizationStatus() != .authorizedWhenInUse)
{
self.navigationController!.popViewController(animated: true)
}
which should force the previous of instance of another custom sub-class of UITableViewController
to display its view again in its viewDidAppear()
method below;
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(true)
// prompts user to turn on location services
locationManager.requestWhenInUseAuthorization()
}
but it doesn't result in the alert message being shown to the user a second time. Both custom sub-class instances of UITableViewController
are embedded in a UINavigationController
instance in my storyboard file.