Today i started to use ADClusterMapView ( https://github.com/applidium/ADClusterMapView ) and studied the example project... so i decided to add the content to my project... every thing was OK no red errors... the simulator turned on and posted a thread... I'm trying to figure out the problem for hours... so maybe you have idea where the problem is...
-(void)viewDidLoad {
[ADClusterMapView class];
NSArray* airports = [Airport allAirports];
[mapView setAnnotations:airports];
[mapView setVisibleMapRect:MKMapRectWorld];
}
-(MKAnnotationView*)mapView:(MKMapView *)aMapView viewForAnnotation:(id<MKAnnotation>)annotation {
static NSString* reuseIdentifier = @"airportAnnotation";
if ([annotation isKindOfClass:[Airport class]]) {
MKAnnotationView* annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:reuseIdentifier];
if (!annotationView) {
annotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:reuseIdentifier] autorelease];
annotationView.canShowCallout = YES;
}
annotationView.image = ((Airport*)annotation).icon;
return annotationView;
}
}
- (MKAnnotationView *)mapView:(ADClusterMapView *)aMapView viewForClusterAnnotation:(id<MKAnnotation>)annotation {
MKAnnotationView * annotationView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"ADMapCluster"];
if (!annotationView) {
annotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation
reuseIdentifier:@"ADMapCluster"]
autorelease];
annotationView.image = [UIImage imageNamed:@"circle.png"];
annotationView.canShowCallout = YES;
}
else {
annotationView.annotation = annotation;
}
return annotationView;
}
the Error in debuger was:
Airports[3489:c07] -[MKMapView setAnnotations:]: unrecognized selector sent to instance 0x8095570 Airports[3489:c07] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MKMapView setAnnotations:]: unrecognized selector sent to instance 0x8095570' * First throw call stack: (0x1945012 0x1275e7e 0x19d04bd 0x1934bbc 0x193494e 0x2b6e 0x29e817 0x29e882 0x1eda25 0x1ee311 0x28db 0x1ba7b7 0x1bada7 0x1bbfab 0x1cd315 0x1ce24b 0x1bfcf8 0x18a0df9 0x18a0ad0 0x18babf5 0x18ba962 0x18ebbb6 0x18eaf44 0x18eae1b 0x1bb7da 0x1bd65c 0x282d 0x2765) libc++abi.dylib: terminate called throwing an exception sharedlibrary apply-load-rules all Current language: auto; currently objective-c