【发布时间】:2018-01-09 20:30:30
【问题描述】:
我正在开发一个 xamarin 形式的应用程序,应该可以在 android 和 ios 上运行。 问题是IOS地图显示位置错误。
IOS 位置(错误)
Android 位置(右)
代码:
switch (Device.RuntimePlatform)
{
case Device.iOS:
uri = new Uri(string.Format("http://maps.apple.com/?ll={0}", x + ',' + y));
System.Diagnostics.Debug.WriteLine(uri);
Device.OpenUri(uri);
break;
case Device.Android:
uri = new Uri("https://www.google.com/maps/search/?api=1&query=" + x + ',' + y);
System.Diagnostics.Debug.WriteLine(uri);
Device.OpenUri(uri);
break;
}
在此示例中,x="39.7301803" 和 y="-8.8438668"
更新
用ExternalMaps插件替换上面的代码
var success = CrossExternalMaps.Current.NavigateTo(Store.Name, Double.Parse(x), Double.Parse(y));
完全一样的结果:(
【问题讨论】:
标签: xamarin.forms maps