Is this a known bug in the MKMapKit?

Discussion in 'iOS Programming' started by MACloop, May 4, 2010.

  1. MACloop macrumors 6502

    May 18, 2009
    Hi all,
    I have been struggeling with some problems when using a navigation controller and a mapview. The problem is that clicking the back button seem to make the app crash. I found this and this posts with the same problem described but the suggestions to solve it (basically taken from link #2) do not work in my app. The crashes appears on the device anyway...

    Has anyone of you been struggeling with the same problem?

    Is there a stabile way to solve it?

    What about this layer method "removeAllAnimations" - I always get the following msg when using it in my code: warning: no '-removeAllAnimations' method found

    Any ideas?

  2. Hardan macrumors newbie

    Nov 10, 2008
    MKMapKit bug

    Make sure the mapView is being retained by your ViewController.

    This is an old thread, but the problem persists.

    This solution I found is the same as link 2, but I was still having problems because my @property declaration for my MKMapView object was set to assign and not to retain, witch would cause a crash. So

    @property (nonatomic, retain) MKMapView * mapView;


    - (void)dealloc{
    // usual releasing...
    mapView.delegate = nil; // This is the problem solver
    [[mapView layer] removeAllAnimations]; // stop all internal animation
    [mapView release];
    [super dealloc];

    Note: the object in question is a UIViewController subclass and is also the delegate of the MKMapView object

    The problem seems to happen because mapView is still sending messages to its delegate even after the ViewController has been released. Setting its delegate to nil solved the problem for me.

    Hope you didn't need this after all this time.

Share This Page