0
做任何1知道swift3什么变化?如何解决下面的代码 我米使用geococdeAddressStringCLGeocodeCompletionHandler IOS swift3
class func getMapByAddress(_ locationMap:MKMapView?, address:String?, title: String?, subtitle: String?)
{
let geocoder = CLGeocoder()
geocoder.geocodeAddressString(address!, completionHandler: {(placemarks: [CLPlacemark]?, error: NSError?) -> Void in
if let validPlacemark = placemarks?[0]{
print(validPlacemark.location?.coordinate)
let span = MKCoordinateSpanMake(0.05, 0.05)
let region = MKCoordinateRegion(center: (validPlacemark.location?.coordinate)!, span: span)
locationMap?.setRegion(region, animated: true)
let annotation = MKPointAnnotation()
annotation.coordinate = (validPlacemark.location?.coordinate)!
annotation.title = title
annotation.subtitle = subtitle
locationMap?.addAnnotation(annotation)
}
} as! CLGeocodeCompletionHandler)
}
错误在此line..is只是崩溃在这条线as! CLGeocodeCompletionHandler)
没有错误只是显示<private>
注释您的代码,然后开始重写它,让Xcode的autosuggest引导您到新的语法。 – Moritz
感谢bro ..great提示 –