Thorny crash: MKMapView and ‘message sent to deallocated instance’

This took a while to debug.

I was getting a crash every time I quit a MapView in my Simulator. It turned out the problem code was this which is used to track the user’s location:

The code I thought was taking care of this was here:

which wasn’t doing the job.

I needed to do this:

Having said that Apple have introduced a new method as of iOS 5.0 that does this a lot more simply.

More here:

and lots of gory SO details here:

Leave a Reply

Your email address will not be published. Required fields are marked *