我試圖通過此示例的幫助獲取設備位置https://github.com/XLabs/Xamarin-Forms-Labs/wiki/Geolocator。這適用於模擬器,但在iPad Air上不起作用。包含所有必要的鍵位置我的Info.plist文件。,NSLocationUsageDescription和NSLocationWhenInUseUsageDescription地理定位不起作用iOS PCL Xamarin表格
在代碼if (this.manager.RespondsToSelector(new Selector("requestWhenInUseAuthorization")))
{
this.manager.RequestWhenInUseAuthorization();
}
一段代碼,其中使用Geolocator對象..
IGeolocator geolocator = null;
geolocator = DependencyService.Get<IGeolocator>();
if (geolocator != null)
{
if (geolocator.IsGeolocationEnabled)
{
try
{
if (!geolocator.IsListening)
geolocator.StartListening(1000, 1000);
var task = await geolocator.GetPositionAsync(10000, CancellationToken.None);
if(task != null)
{
this.Position = task;
}
但LocationUpdated事件從不開火......
設備上的位置已打開。
如果有人有類似的問題.......請幫助.....一次,這項工作在模擬器上。
我在iPad Air上使用VS 2013,Xamarin 3.7,Xamarin.iOS 8.4,iOS 8.1。