Я пытаюсь преобразовать cllocationcoordinate2d в cllocation. Я получаю сообщение об ошибке «Ожидаемое выражение в литерале контейнера» в строке 12 кода ниже. Я также получаю сообщение об ошибке «Не удается преобразовать значение типа cllocationcoordinate2d в ожидаемое значение cllocation» в строке 13, но это потому, что строка 12 работает неправильно.
@IBAction func makeEvent(sender: UIButton)
{
let center = CLLocationCoordinate2D(latitude: loc1.coordinate.latitude, longitude: loc1.coordinate.longitude)
let lat: CLLocationDegrees = center.latitude
let long: CLLocationDegrees = center.longitude
self.pointAnnotation1 = MKPointAnnotation()
self.pointAnnotation1.title = "Event"
self.pointAnnotation1.coordinate = CLLocationCoordinate2D(latitude: lat, longitude: long)
self.pinAnnotationView = MKPinAnnotationView(annotation: self.pointAnnotation1, reuseIdentifier: nil)
self.mapView?.centerCoordinate = self.pointAnnotation1.coordinate
self.mapView.addAnnotation(self.pinAnnotationView.annotation!)
CLLocation *center = [[CLLocation alloc] initWithLatitude:latt longitude:longg]
eventRecord.setObject(center, forKey: "event")
let publicData = CKContainer.defaultContainer().publicCloudDatabase
publicData.saveRecord(eventRecord) { record, error in
}
if error == nil
{
print("Location saved")
}
loadEvent(){ (error, records) in
if error != nil {
print("error fetching locations")
} else {
print("Found Event")
}
}
}
CLLocation *center = [[CLLocation alloc] initWithLatitude:latt longitude:longg]
- это Objective-C, а не Swift. - person Martin R   schedule 31.08.2016