ios - XCode 6.3 MKPointAnnotation setCoordinate missing -
i updated xcode 6.3 , receiving below error: mkpointannotation not have member named 'setcoordinate'.
not sure went, or if supposed use other mk method. appreciated.
func refreshlocation(lat:string, lon:string, withoffset:bool = false){ // 1 convert string values can used. let location = cllocationcoordinate2d( latitude: (lat nsstring).doublevalue cllocationdegrees, longitude: (lon nsstring).doublevalue cllocationdegrees ) // 2 setup initial variables. let span = mkcoordinatespanmake( (self.locationlatitudedelta nsstring).doublevalue cllocationdegrees, (self.locationlongitudedelta nsstring).doublevalue cllocationdegrees ) let region = mkcoordinateregion(center: location, span: span) mapview.setregion(region, animated: true) //3 decorate point , add point map. var annotation = mkpointannotation() annotation.setcoordinate(location) //error on line }
as stated in ios 8.3 api diffs in mapkit module, setcoordinate
method removed:
removed mkannotation.setcoordinate(cllocationcoordinate2d)
fortunately, must use simpler assignment syntax (which available in previous versions of swift , same done in objective-c):
annotation.coordinate = location