Mistake which cost me some time


Thought I’d post this in case anyone else was as boneheaded as me. My code ran for me but every time I tried to add an annotation nothing was happening. After a few hours I decided to see if the annotation was happening somewhere else on the map that I couldn’t see so I remmed out the zoom lines in Whereamiviewcontroller.m

//Zoom the region to this location //MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(coord, 250, 250); //[worldView setRegion:region animated:YES];

When I did that I found that my annotation was being placed on the map with the correct text in the atlantic ocean near Africa. I have a feeling this is some zero coordinate. My code was incorrect in BNRMapPoint.m as:

-(id)initWithCoordinate:(CLLocationCoordinate2D)c title:(NSString *)t { self = [super init]; if (self){ coordinate = coordinate ; [self setTitle:t]; } return self; }

Of, course it should not be “coordinate = coordinate;” but “coordinate = c;” as follows:

-(id)initWithCoordinate:(CLLocationCoordinate2D)c title:(NSString *)t { self = [super init]; if (self){ coordinate = c; [self setTitle:t]; } return self; }


I guess we learn more from our mistakes !