I am using the CloudKit cursor in my app and the cursor works because I can see it from the print (cursor code: https://controlc.com/0d42933b). However, I see nothing on the map (I am using MapKit, CloudKit, and SwiftUI in my project). Below is my View Model:
…
func fetchLocations() {
ckController.database.fetchRecords(with: RecordType.location) { (results, moreComing, error) in
print("fetchRecords: results.count = \(results.count), moreComing = \(moreComing), error = \(String(describing: error))")
if !moreComing {
DispatchQueue.main.async { [self] in
objects = results
}
}
}
}
…
Below is my implementation in the view:
…
.task {
if locationManager.locations.isEmpty {
viewModel.fetchLocations()
}
}
…
Print (I have 155 records):
fetchRecords: results.count = 1, moreComing = true, error = nil fetchRecords: results.count = 2, moreComing = true, error = nil
… fetchRecords: results.count = 155, moreComing = true, error = nil fetchRecords: results.count = 155, moreComing = false, error = nil
Somebody knows solutions? Where is a mistake and how I can see all my elements on the map finally?