Saya mencoba mengubah cllocationcoordinate2d menjadi cllocation. Saya mendapatkan kesalahan "Ekspresi yang diharapkan dalam wadah literal" pada baris 12 dari kode di bawah ini. Saya juga mendapatkan kesalahan "Tidak dapat mengubah nilai tipe cllocationcoordinate2d menjadi nilai cllocation yang diharapkan" pada baris 13 tetapi itu karena baris 12 tidak berfungsi dengan benar.
@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]
adalah Objective-C, bukan Swift. - person Martin R   schedule 31.08.2016