The Core Data setup was fairly straightforward: I wanted Point to store latitude, longitude, and title, so I added two numeric and one string attribute to the Point entity. […] Right off the bat, it seemed like the easiest thing to do was to make the Point instances themselves conform to MKAnnotation. They already had
title; all that was left was to merge the former into a
In testing, though, this soured quickly: a critical operation in everyday use was deleting a Point from the database. However, telling the map view to remove a Point annotation wasn’t quite as prompt as it should have been. Annotations would remain on the map for a few seconds, or in rare cases much longer.
In the “Discussion” section of the docs for
MKAnnotation.coordinate, there exists this critical qualifier […] As soon as I noticed this, everything clicked: the map was likely using KVO to watch for changes in an annotation’s coordinate, in order to update its location.
Stay up-to-date by subscribing to the Comments RSS Feed for this post.