MapKit Deallocation Crash

Originator:JamesValaitis
Number:rdar://35830744 Date Originated:December 4 2017, 5:22 PM
Status:Open Resolved:
Product:MapKit Product Version:
Classification: Reproducible:Always
 
Area:
MapKit

Summary:
Deallocation of an `MKMapView` after the addition of annotations will cause a crash.

Steps to Reproduce:
Create blank `UIViewController` embedded within a `UINavigationController` with button which triggers segue to push another view controller.
In the second `UIViewController` place a `MKMapView` and in `viewDidLoad` add an array of annotations:
`addAnnotations(newAnnotations)`
animate the display of the annotations:
`showAnnotations(newAnnotations, animated: true)`
While the animation is taking place quickly press the back button to deallocate the view controller and it's child map view.

Expected Results:
The view controller should be popped without issue.

Actual Results:
The app will crash because the map view will attempt to add the annotations after deallocation.

Version/Build:
Xcode Version 9.1 (9B55)
iOS 11.1.2 (15B202)

Configuration:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!