2
作爲標題,我對如何使用MonoTouch捕獲地圖以及如何獲取位置感到困惑。如步驟:MonoTouch獲取位置和捕獲地圖圖像,如聯繫人
CLLocationManager locationManager = new CLLocationManager();
locationManager.UpdatedLocation += UpdatedLocationEvent;
locationManager.Delegate = new MyLocationDelegate();
locationManager.StartUpdatingLocation();
class MyLocationDelegate : CLLocationManagerDelegate
{
public MyLocationDelegate() : base()
{
}
public override void UpdatedLocation (CLLocationManager manager, CLLocation newLocation, CLLocation oldLocation)
{
Console.WriteLine ("newLocation " + newLocation.VerticalAccuracy + " " + newLocation.HorizontalAccuracy);
Console.WriteLine ("oldLocation " + oldLocation.VerticalAccuracy + " " + oldLocation.HorizontalAccuracy);
}
public override void Failed (CLLocationManager manager, NSError error)
{
Console.WriteLine ("Failed to find location");
}
}
它不起作用。請幫幫我。
你需要解釋「不工作」。它會崩潰嗎?你有任何錯誤?什麼是或沒有發生?您應該使用CLLocation的座標屬性或水平/垂直精度。 – Jason 2011-04-15 12:26:09
沒有崩潰,沒有錯誤,但沒有工作,我無法獲得當前位置。 – 2011-04-18 01:37:34