Hello everybody.
Recently downloaded "MapKitDragAndDrop 3" package (http://github.com/digdog/MapKitDragAndDrop) to use in my app. The demo project runs smoothly.
Both DDAnnotation.h+m and DDAnnotationView.h+m files were imported as they are. The method of calling the class was also copied/pasted.
DDAnnotation *annotation = [[[DDAnnotation alloc] initWithCoordinate:theCoordinate addressDictionary:nil] autorelease];
annotation.title = @"Drag to Move Pin";
annotation.subtitle = [NSString stringWithFormat:@"%f %f", annotation.coordinate.latitude, annotation.coordinate.longitude];
[self.mapView addAnnotation:annotation];
The first run resulted in "unrecognized selector sent to instance" exception. Debugger suggests that I implement setCoordinate methods in DDAnnotation class; yet the demo files has neither @synthesize nor methods implementation.
DDAnnotation.m:
#import "DDAnnotation.h"
@implementation DDAnnotation
- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate addressDictionary:(NSDictionary *)addressDictionary {
if ((self = [super initWithCoordinate:coordinate addressDictionary:addressDictionary])) {
// NOTE: self.coordinate is now different from super.coordinate, since we re-declare this property in header,
// self.coordinate and super.coordinate don't share same ivar anymore.
self.coordinate = coordinate; // CHECKPOINT
}
return self;
}
@end
Upon tracing the DDAnnotation.m it falls into DDAnnotation.h on CHECKPOINT in debugger. In my app, it doesn't.
I really expect the mistake to be stupid, yet I just don't know where to look. Thanks.