Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As it turns out, there is a known bug with iOS 6 and <code>MKMapView</code> not releasing it's memory correctly. Unfortunately there is no real fix other than trying to force the map view to purge it's cache which doesn't have that great of an impact on releasing memory.</p> <p>The strange thing is that even when the app is receiving memory warnings, the map view cache is still not being purged properly. Eventually, the app becomes unstable and is killed by the OS.</p> <p>Apple has been getting very sloppy with their testing lately. This is the second bug with <code>MKMapView</code> that I've come across (the other being <code>mapViewDidFinishLoadingMap:</code> being called early) and both bugs have been really obvious to catch if they had just done some performance and sanity testing.</p> <p>Here is some code which may help:</p> <pre><code>- (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; // This is for a bug in MKMapView for iOS6 [self purgeMapMemory]; } // This is for a bug in MKMapView for iOS6 // Try to purge some of the memory being allocated by the map - (void)purgeMapMemory { // Switching map types causes cache purging, so switch to a different map type detailView.mapView.mapType = MKMapTypeStandard; [detailView.mapView removeFromSuperview]; detailView.mapView = nil; } </code></pre> <p>The other thing you could do is use one instance of the <code>MKMapView</code> throughout your entire app and that should help minimize how much memory is allocated each time the view is shown since the map view will already be allocated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload