问题
I'm working in a ios recursive function to send the message 'My App need request your location' each time that the user turn off his GPS then, the message should appears again requesting his location.
I'm just using:
public bool LocationServicesEnabled {
get {return CLLocationManager.LocationServicesEnabled;}
}
public bool IsAuthorized {
get {return CLAuthorizationStatus.Authorized == _authstatusLast;}
}
With those functions, the first one return me is the Service is Enable and the second one if the user autorizate it.
Just now, I can do something similar to:
if(_locationServiceEnalbed && IsAuthorized){
Manager = new LocationManager();
Manager.StartLocationUpdates();
}
But is not requesting me my location again. How I can display the message again requesting the user location?
回答1:
According to Apple, if they deny access to your app, you can request it again by trying to start the location services
If it returns NO and you attempt to start location services anyway, the system prompts the user to confirm whether location services should be re-enabled. Because the user probably disabled location services on purpose, the prompt is likely to be unwelcome.
However, a more friendly approach might be to display a message that this feature of your app is disabled until they grant permissions to use GPS, and to direct them to the Settings menu where it can be re-enabled
来源:https://stackoverflow.com/questions/26723129/xamarin-recursive-location-request