我的谓词想要排除一些已经下载并在 [CKRecordID] 中可用的记录。现在我可以查询 1 个 CKRecordID[0],但不能查询 [CKRecordID] 数组。如何查询数组?
let excludeIDs: [CKRecordID]
这有效:
let pred1 = NSPredicate(format: "NOT(recordID = %@)", excludeIDs[0])
但这不会:
let pred1 = NSPredicate(format: "NOT(recordID IN %@)", excludeIDs)
错误:loadImageCompareRecordIDsAndEndDateThatHaveNotEnded 错误:无效谓词:无效谓词:数组成员必须符合 CKRecordValue:(“”,“”,“”,“”,“”)(CKRecordID)
代码的其他通用部分:
let sort = NSSortDescriptor(key: "creationDate", ascending: false)
let query = CKQuery(recordType: MyRecordTypes.ImageCompare, predicate: pred1)
query.sortDescriptors = [sort]
let operation = CKQueryOperation(query: query)
operation.desiredKeys = ["endDate"]
operation.resultsLimit = 50