How on Ios when launching an application, request permission? Alert window does not appear.
The following settings were made to the Info.plist file:
<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
<key>NSLocationAlwaysUsageDescription</key>
<string>Required for the application to work</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Required for the application to work</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Required for the application to work</string>
Alert window does not appear.
When using Location , just adding key-vaule in Info.plist is not enough, also need to request permission when app runtime.
Adding follow code to have a try :
CLLocationManager locationManager = new CLLocationManager();
locationManager.RequestWhenInUseAuthorization();
//Requests permission to use location services while the app is in the foreground.
Or
locationManager.RequestAlwaysAuthorization();
//Requests permission to use location services whenever the app is running.
Here is the apple document , and a xamarin sample.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments