0
我得到的錯誤:「類'ViewController'沒有初始化程序」。我已經將問題縮小到了被調用的這個函數。有沒有人看到這個問題?在ViewController上獲取初始化器錯誤
let locationManager1: CLLocationManager // your location manager
func addBoundry(loc: CLLocation)
{
if let loc: CLLocation! = locationManager1.location {
let center: CLLocationCoordinate2D = loc!.coordinate
let lat: CLLocationDegrees = center.latitude
let long: CLLocationDegrees = center.longitude
var points = [CLLocationCoordinate2DMake(lat,long),CLLocationCoordinate2DMake(lat,long),CLLocationCoordinate2DMake(lat,long),CLLocationCoordinate2DMake(lat,long)]
let polygon = MKPolygon(coordinates: &points, count: points.count)
mapView.addOverlay(polygon)
} else {
print("no location...")
}
}
檢查[這些搜索結果](http://stackoverflow.com/search?q=%5Bswift%5D+class+has+no+initializer)。 – rmaddy