views:

492

answers:

2
+1  Q: 

Bug in MKMapView?

When I open MapView with navigationcontroller in a new view, then not waiting till map loads, and then clicking on the back button - I an exception is thrown. Can anyone confirm this? What is a work-around?

+3  A: 

Are you releasing the mapview when deallocating your navigationcontroller?

It may be that the mapview is sending a message to its delegate (your navigation controller), after the delegate has been released.

Try setting the mapview's delegate to nil before releasing it.

frankodwyer
+1  A: 

I had this exact error.

Its caused by some of the delegate methods in your class, once you pop that class and the map is busy doing things it tries to call class that has left memory.

I simply added

- (void)dealloc
{   
    // release the map delegate otherwise it will try and call our classes with no data.
    // map for me is my MKMapView
    map.delegate = nil;
    [super dealloc];
}
John Ballinger