Code on p79 throws an error


In the bottom of the page 79 the code

    MKAnnotationView *annotationView = [views objectAtIndex:0];
    id <MKAnnotation> mp = [annotationView annotation];
    MKCoordinateRegion region = 
        MKCoordinateRegionMakeWithDistance([mp coordinate], 250, 250);
    [mv setRegion:region animated:YES];

is added to the Whereami application.

This causes an error as displayed in the console:
Tue Nov 2 18:16:59 iPhone Whereami[3550] : CGImageCreateWithImageProvider: invalid image size: 0 x 0.

The Whereami app from the examples .zip provided by Big Nerd Ranch has the same error.

For my application the result is that the app doesn’t zoom in, whereas it does zoom in for the example app. The method is copy-pasted from the example. The issue here might be that the example has more extra code in it added later on in the chapter.

Any ideas how to fix it?


Build against 4.1 and it should. It looks like they changed this in 4.2 to a new method - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation.

The error in the console is not an error, but debug log left in by Apple.