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");
}
}
它不起作用。请帮我。
As the title, I'm confused with how to capture maps with MonoTouch, and how to get the location. As step by:
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");
}
}
It doesn't work. Please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您还没有配置获得的事件类型,您缺少这样的行:
You have not configured the kind of events that you get, you are missing a line like this: