如何查询CloudKit的recordID IN
我的谓词想要排除一些已经下载并且在[CKRecordID]中可用的logging。 现在我可以查询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
使用[CKReference]而不是[CKRecordID]解决了它。