When I run locationManager.requestWhenInUseAuthorization() for the first time, the standard "Allow AppName to access your location while you use the app" pops up and never again based on the standard IOS design (regardless of whether the user chose Allow of Dont Allow). The following code is in ViewDidLoad inside my main view controller
// Check location status
if locationAuthStatus == CLAuthorizationStatus.AuthorizedWhenInUse {
self.displayMessage.hidden = false
self.displayMessage.text = "Waiting for GPS Signal..."
} else {
locationManager.requestWhenInUseAuthorization()
}
The problem I have with this is if the user quits the program, disable the location service, and come back in, there would be no popup asking the user to enable location as it was already shown. So I want to add another custom pop up to ask for permission if the following two condition is true
- initial popup has been displayed previously
- location service is not enabled.
Initially I had my popup code just after locationManager.requestWhenInUseAuthorization(). However, that was causing a problem. If the user used the app for the first time, he will be prompted with the default popup, then there would be my popup right after that...
Thanks,