Instance variable vs. property


So using coordinate = c works fine. The program builds, and runs and we get our red pin.

However, if I use [self setCoordinate:c] The program builds fine, but when you run it and try to annotate, it doesn’t work!

Now why is that? I just need to know for peace of mind.

Thank you!


If you look at the declaration of coordinate in BNRMapPoint.h

it has the attribute readonly. So when we synthesized coordinate in BNRMapPoint.m no setter is implemented.

When you run the app with

look at the console for “unrecognized selector.” In mine I got the following:
2012-07-30 19:54:03.322 Whereami[4186:c07] -[BNRMapPoint setCoordinate:]: unrecognized selector sent to instance 0x6df8b30