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提示 –