iphoneobjective-cios3.0

MKMapViewDelegate viewForAnnotation method


I have a map loading up on my iPhone which shows pin annotations. I set these up by having objects which conform to the MKAnnotation protocol.

Now, the annotations show up on the simulator but, rather bizarrely, not on the device. FYI, I've got network connectivity on both and the device is running iOS 3.1.3.

Any suggestions?

EDIT

Objects are instances of a class like this:

@interface Point : NSObject <MKAnnotation> {
// etc...

then these are added to the Map View Controller like this:

MyMapViewController *m = [[MyMapViewController alloc] initWithNibName:@"myMap" bundle:nil];
// Set up Point, thisPoint, with location info...
m.point = thisPoint; 

Note, my viewForAnnotation method is not being called on the device. It IS being called on the simulator (i.e. the pin is shown on the simulator).


Solution

  • I had forgotten the addAnnotation call. Odd how it worked on the simulator but not on the device!

    Perhaps the simulator was running a different build or you had different code running based on version.