1
我有一個像下面的代碼,但「CLLocation loc = mapView.MyLocation;
」assigne null loc對象,所以我不能採取cuurent的位置。谷歌地圖sdk如何獲得當前位置在xamarin ios
如何獲得我的當前位置在ios谷歌地圖sdk ios的ios。
//and many other using
using Google.Maps;
public partial class MapNavigationController : UIViewController
{
MapView mapView;
public override void LoadView()
{
base.LoadView();
var camera = CameraPosition.FromCamera (latitude: 7.2935273,
longitude: 80.6387523,
zoom: 13);
mapView = MapView.FromCamera (RectangleF.Empty, camera);
mapView.MyLocationEnabled = true;
mapView.MapType = MapViewType.Hybrid;
CLLocation loc = mapView.MyLocation;
Console.WriteLine("tapped at " + loc.Coordinate.Latitude + "," +loc.Coordinate.Longitude);
}
}