I upgraded a perfectly working 6.1 app to Xcode 5/ios 7 that uses MKMapKit to show some pins on a mapview.
Now the annotation pins dont show up. Ive made sure my mapview delegate is correct and viewForAnnotation is being called. Im also sure its title and subtitle are set, but now the pin just doesnt display. Anyone have any ideas what to look for beyond this?
When it runs, I see my lat/lon, pin title, and subtitle filled in.
Heres my code:
- (MKAnnotationView *) mapView:(MKMapView *) theMapView viewForAnnotation:(id <MKAnnotation>)annotation
{
if ([annotation isKindOfClass:[MKUserLocation class]])
{
return nil;
}
[self.mapView removeAnnotations:self.mapView.annotations];
MKPointAnnotation *pt = (MKPointAnnotation *)annotation;
NSString *PINNAME = pt.title;
CLLocationDegrees lat = pt.coordinate.latitude;
CLLocationDegrees lon = pt.coordinate.longitude;
[Log log:TINFO :@"lat/lon %f - %f", lat, lon];
[Log log:TINFO :@"pin title userid = %@", pt.title];
[Log log:TINFO :@"subtitle: %@", pt.subtitle];
MKPinAnnotationView *pinView = (MKPinAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier: PINNAME];
if(pinView == nil)
{
pinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:PINNAME];
pinView.pinColor = MKPinAnnotationColorGreen;
}
else
{
pinView.annotation = annotation;
}
return pinView;
}