我想访问当前位置的长纬度,因此我正在通过地理位置定位器进行操作,但它没有到来。 我的代码如下:
public async void GetCurrentLocation()
{
try
{
{
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 50;
var position = await locator.GetPositionAsync(timeout: TimeSpan.FromMilliseconds(10000));
activityMainData.Longitude = position.Longitude.ToString();
activityMainData.Latitude = position.Latitude.ToString();
activityMainData.Altitude = position.Altitude.ToString();
}
}
catch (Exception ex)
{
throw ex;
}
}
我具有以下权限:
NSLocationWhenInUseUsageDescription
NSLocationAlwaysAndWhenInUseUsageDescription
Location Always Usage Description
但是我现在还没来得及 请尽快帮我。谢谢