i have MKMapView in a view controller and when i starts zooming on it consume a lot of memory and when i leave the view who contains the MKMapView the memory is not released (I am using ARC in my App)
Edit:
i read in some stack overflow answers that i have to put the MKMapView in AppDelegate :
-(MKMapView*) mapView
{
if(_mapView == nil) {
_mapView = [[MKMapView alloc] init];
}
return _mapView;
}
and in viewWillDisappear of viewController that contains the MKMapView put
-(void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
XAppDelegate.mapView.delegate = nil;
[XAppDelegate.mapView removeFromSuperview];
}
but it did not resolve my problem.
A common flaw I've seen is that the MKOverlay is holding a strong reference to the MKOverlayView
/MKOverlayRender
and the MKMapView
. This causes a retain cycle because the MKMapView
holds a strong reference to the MKOverlay
instances as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With