0
Cloudkit의 데이터베이스에 여러 개의 CKR 코드가 있습니다. CKR 코드를지도의 주석으로 바꿉니다. 내 queryhandation에서 내 변수 var annotation = MKPointAnnotation()
앞에 self
을 추가해야했던 이래로 내지도에 하나의 주석 만로드되었습니다. 왜 그런데 어떻게 수정합니까 ??? 어떤 도움이 굉장 할 것입니다! 나는 문제가 항상 같은 주석을 사용하고 있는지이라고 생각보다 상세하게 코드를 검토 한 후내 QueryOperation에서 CloudKit의 데이터를 차단하는 이유는 무엇입니까?
var points: [MKPointAnnotation] = []
var annotation = MKPointAnnotation()
let database = CKContainer.default().publicCloudDatabase
func fetchTruck() {
let truePredicate = NSPredicate(value: true)
let eventQuery = CKQuery(recordType: "User", predicate: truePredicate)
let queryOperation = CKQueryOperation(query: eventQuery)
queryOperation.recordFetchedBlock = { (record) in
self.points.append(self.annotation)
self.annotation.title = record["username"] as? String
self.annotation.subtitle = record["hours"] as? String
if let location = record["location"] as? CLLocation {
self.annotation.coordinate = location.coordinate
}
print("recordFetchedBlock: \(record)")
self.mapView.addAnnotation(self.annotation)
}
self.database.add(queryOperation)
}
코드,하지만 감사와 행운을보십시오! – kcamp