【发布时间】:2011-02-24 12:49:22
【问题描述】:
这是我的情况。出于某种原因,我保存在核心数据中的注释坐标似乎与我可以从地图上的大头针位置检索到的坐标不匹配。
因此,我使用以下方式将数据保存到核心数据中:
[ride setLatitude:[NSNumber numberWithDouble:newRidePlacemark.coordinate.latitude]];
[ride setLongitude:[NSNumber numberWithDouble:newRidePlacemark.coordinate.longitude]];
我非常肯定这是保存 long 和 lat 的正确格式。但是,当我将核心数据中的坐标与放置的 pin 的坐标进行比较时,问题就出现了。我使用方法和日志来查看引脚的位置:
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
NSLog(@"%f, %f", view.annotation.coordinate.latitude, view.annotation.coordinate.longitude);
这给了我类似的东西:
38.119432, -122.225647
但是,与此同时,我正在检查该引脚的核心数据中保存的内容,并且我有:
38.11943249695161,-122.2256469726562
这种差异从何而来?为什么要缩短一个?这是一个真正的问题,因为当我尝试删除注释时,坐标不匹配,并且注释没有被删除。
我错过了什么吗?
【问题讨论】:
标签: iphone core-data mapkit mkmapview mkannotation