【发布时间】:2016-02-19 00:16:52
【问题描述】:
下面是代码:
private func getReverseGeocodeData(newCoordinates : CLLocationCoordinate2D) -> CLPlacemark? {
let clLocation = CLLocation(latitude: newCoordinates.latitude, longitude: newCoordinates.longitude)
GCAnnotation.geocoder.reverseGeocodeLocation(clLocation) { placemarks, error in
if let pms = placemarks {
let pm : CLPlacemark? = pms.first as CLPlacemark?
return pm // ==> "Unexpected non-void return value in void function"
}
}
return nil
}
【问题讨论】:
-
即我已将 pm 作为可选项并返回它......所以这不应该工作吗?
-
包含
return pm的闭包没有指定返回值,只有外部函数有。
标签: ios xcode swift optional optional-parameters