【发布时间】:2017-09-21 21:55:15
【问题描述】:
我正在使用地理定位器来获取用户位置,但是,在 ios 更新到 ios 11.0 后,我的地理定位器无法工作...... 在android中它工作正常,并且在ios更新之前它也可以工作 这是我的地理定位器课程
using neoFly_Montana.Model;
using Plugin.Geolocator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace neoFly_Montana.Api
{
class Geolocator
{
public static async Task<Localizacao> GetUserLocationAsync()
{
try
{
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 50;
//try
//{
var auxPosition = await locator.GetPositionAsync(TimeSpan.FromSeconds(10));
//} catch(Exception e)
//{
// var i = e.Message;
//}
if (auxPosition == null)
{
return null;
}
else {
Localizacao position = new Localizacao();
position.latitude = auxPosition.Latitude;
position.longitude = auxPosition.Longitude;
//teste joyce iphone
// position.latitude = -22.8899748;//-23.5505199;
// position.longitude = -47.0713897;// -46.6333094;//
return position;
}
}
catch (Exception ex)
{
var teste = ex.Message;
return null;
}
}
}
}
调用此行后
var auxPosition = await locator.GetPositionAsync(TimeSpan.FromSeconds(10));
它停止工作
【问题讨论】:
标签: ios xamarin xamarin.forms