我正在使用3.1.3 SDK的iPhone应用程序,我的应用程序发现用户当前的位置,显示它在的MKMapView,然后查找附近的位置并将它们呈现为MKAnnotations。我的代码工作,但有时附近的注解不会显示在地图上。他们仍然被做成我看到了(它运行的注解是由刚刚从后NSLog的)控制台正确的数据。MKAnnotations正在成功地进行了,但是他们有时无法呈现上的MKMapView
当它失败完全是随机的,也可能是第五次我打“生成和运行”为天,或第500它不会出现有任何的图案,并且不抛出任何类型的错误,它只是不会将注释添加到MapView。
这就是所谓的每个位置附近添加MKAnnotation的方法。
- (void)addPinsWithLocation:(NSDictionary *)spot
{
CLLocationCoordinate2D location;
location.longitude = [[spot objectForKey:@"spot_longitude"] doubleValue];
location.latitude = [[spot objectForKey:@"spot_latitude"] doubleValue];
PlaceMarks *placemark = [[PlaceMarks alloc] initWithCoordinate:location title:[spot objectForKey:@"spot_name"] subtitle:@""];
NSLog(@"Adding Pin for Location: '%@' at %f, %f", [spot objectForKey:@"spot_name"], location.latitude, location.longitude);
[mapView addAnnotation:placemark];
}
如何让MKAnnotations总是表现出任何的想法?