我如何通过其记录名称查询 CloudKit 以获取特定记录?
以下代码给了我一个错误。
let recordName = "BBBA9068-D01A-9D55-3D6B-4460A7B36D57"
let predicate = NSPredicate(format: "recordID=%@", recordName)
let query = CKQuery(recordType: "Route", predicate: predicate)
privateDatabase.perform(query, inZoneWith: nil) {
(records: [CKRecord]?, error: Error?) in
if error != nil {
print(error!.localizedDescription)
} else {
if let records = records {
print(records.first as Any)
}
}
}
调试窗口显示:
字段“___recordID”的值类型为 REFERENCE,无法使用筛选值类型 STRING 进行查询