假设我有一个“物种”记录类型,其中包含由许多用户创建的公共记录。目前,我的查询检索“物种”的所有记录:
private func fetchSpecies() {
// Fetch Public Database
let publicDatabase = CKContainer.defaultContainer().publicCloudDatabase
// Initialize Query
let query = CKQuery(recordType: "Species", predicate: NSPredicate(format: "TRUEPREDICATE"))
// Configure Query
query.sortDescriptors = [NSSortDescriptor(key: "latinName", ascending: true)]
// Perform Query
publicDatabase.performQuery(query, inZoneWithID: nil) { (records, error) -> Void in
dispatch_async(dispatch_get_main_queue(), { () -> Void in
// Process Response on Main Thread
self.processResponseForQuery(records, error: error)
})
}
}
如何仅获取当前用户(如设备所有者)创建的记录?
谢谢!