views:

470

answers:

1
+1  Q: 

MKMapView disposal

Hello, I have a strange(?) crash after releasing MKMapView. MKMapView is a subview in my view controller and after I remove that view from navigation stack and release it application crashes with this stack:

...
#4  0x34196dc8 in -[MKMapView(UserPositioningInternal) locationManagerFailedToUpdateLocation:withError:]
#5  0x3417030c in -[MKLocationManager _reportLocationFailureWithError:]
#6  0x3416de94 in -[MKLocationManager locationManager:didFailWithError:]
#7  0x3205f538 in -[CLLocationManager onClientEventLocation:]
#8  0x3205dd5c in -[CLLocationManager onClientEvent:supportInfo:]
...

Do I have to perform some extra steps when dispose of my view?

Edit: setting mapView.showsUserLocation to NO in controller's dealloc method seems to help. Still the question is - is it intended behaviour?

+4  A: 

In dealloc, before releasing the mapView set its delegate to nil.

In addition, if you are using things like the ReverseGeocoder and a CLLocationManager you'll probably want to do the same thing.

bpapa
Thanks that makes sense
Vladimir