如何使用此特定 id -MqXU-kkVhl5ef10XD查询此字段myId
邮政:
let database = CKContainer(identifier: "iCloud.com.myCo.myApp").publicCloudDatabase
let record = CKRecord(recordType: "Sample")
record["myId"] = "-MqXU-kKVhl5ef10XD"
database.save(record) { (ckRecord, error) in
})
询问:
let predicate = NSPredicate()
let query = CKQuery(recordType: "Sample", predicate: predicate)
database.perform(query, inZoneWith: nil) { (ckRecords, error) in
if let err = error { return }
guard let records = ckRecords else { return }
guard let record = records.first else { return }
guard let myId = record.value(forKey: "myId") as? String else { return }
print(myId)
})