此操作不检索任何内容。没有调用CkFetchRecordsCOmpletion块吗?感谢您的宝贵时间!
public func getRecord(recordID: CKRecord.ID, completion: @escaping (CKRecord?, CKError?) -> Void) {
let operation = CKFetchRecordsOperation(recordIDs: [recordID])
operation.fetchRecordsCompletionBlock = { (records, error) in
// Checking for potential errors
if let error = error {
completion(nil, error as? CKError)
print(error)
}
if let record = records?[recordID] {
completion(record, nil)
}
}
operation.qualityOfService = .utility
let privateDatabase = CKContainer(identifier: "something").privateCloudDatabase
privateDatabase.add(operation)
}