I'm new to ios, but have the following question.
When the app starts, the user should accept the location permission. This works fine. If he doesn't allow, some features don't work.
However, I want it that when the user tries to use these features, he gets an alert that he didn't accept the location permission. This I also did. However I want the alert to have a button which will allow him to accept it now (so he doesn't have to go into settings on his phone to do it) This I couldn't manage to do.
I made a handler for the alert like this, but it doesn't work to accept the permission. Here is the handler...
func someHandler(alert: UIAlertAction!) {
print("User now wants to let location from new")
self.locationManager.requestWhenInUseAuthorization()
if CLLocationManager.locationServicesEnabled() {
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
locationManager.startUpdatingLocation()
}
}
Is this wrong, What else should I put it. Currently, when the handler is called the location services are not turned on.
Thanks