xcode模拟器骑自行车或公路驾驶坐标是错误的?

时间:2015-04-19 08:48:57

标签: xcode ios-simulator mapkit

它只是我还是这真的是一个错误,当我将模拟器位置设置为骑自行车时,纬度始终为0,而​​经度正在更新?

当我打印出坐标时,我不断得到这样的数字:

0,789442777752750357664707662594831481658901059219640184274 .....

1 个答案:

答案 0 :(得分:0)

我明白了......

显然,下面方法中的位置随着自行车或汽车的变化而更新是非常错误的。我需要使用aUserLocation而是用自己的信息创建一个坐标,以找出正确的当前坐标。

- (void)mapView:(MKMapView *)aMapView didUpdateUserLocation:(MKUserLocation *)aUserLocation {
CLLocationCoordinate2D location;

我不知道为什么会这样,但这解决了它。

 CLLocationCoordinate2D loc;
    loc.latitude = aUserLocation.coordinate.latitude;
    loc.longitude = aUserLocation.coordinate.longitude;
    currentCoordinate = loc;