Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MACloop

macrumors 6502
Original poster
May 18, 2009
393
0
Germany
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?

MACloop
 
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;

and

- (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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.