我想知道如何从 CloudKit 表中获取第一条记录。例如,我有一个“类”表,我只想获取上次修改的类,而不是像现在这样获取所有类:
let pred = NSPredicate(format: "Students CONTAINS %@", studentRecord)
var query = CKQuery(recordType: "Class", predicate: pred)
publicDB.performQuery(query, inZoneWithID: nil) {
records, error in
if error != nil {
println("\(error)")
} else {
if records.count > 0 {
for record in records {
println("\(record)")
}
}
}
}