I use CoreData to save/load locations with a title and description. The loading/saving works properly. The latitude and longitudes are saved as NSNumbers. The annotation used in the below code is correct and has data in it.
Somehow, the pin is not being placed on the map. Why?
func setAnnotationPinOnMap(annotation : NSManagedObject)
{
var subject: AnyObject? = annotation.valueForKey("subject")
var desc: AnyObject? = annotation.valueForKey("desc")
var langitude: AnyObject? = annotation.valueForKey("langitude")
var longitude: AnyObject? = annotation.valueForKey("longitude")
println(annotation);
let pin = MKPointAnnotation()
let location = CLLocationCoordinate2D(
latitude: langitude as CLLocationDegrees,
longitude: longitude as CLLocationDegrees
)
println(location.longitude, location.latitude)
pin.setCoordinate(location)
pin.title = subject as String!
pin.subtitle = desc as String!
mapView.addAnnotation(pin)
}