[英]CloudKit query for reference in array
Let's say I have two CloudKit record types: 假设我有两种CloudKit记录类型:
Company 公司
Employee 雇员
In my app if I have an array Companies, is there a way to query CloudKit for all Employees whose company is in this array with a single query? 在我的应用程序中,如果我有公司数组,是否可以通过单个查询为公司在此数组中的所有雇员查询CloudKit? Obviously I could go through the
companies
array and query one by one, but if this array is large then that's going to be a lot slower. 显然,我可以遍历
companies
数组并逐个查询,但是如果这个数组很大,那将会慢很多。
The docs say that you can reference an array in a CKQuery predicate, but doesn't say how. 文档说您可以在CKQuery谓词中引用数组,但没有说明如何。
Yes you can use the predicate 是的,您可以使用谓词
NSPredicate(“%k IN %@“, company, arrayofcompaniesReference) NSPredicate(“%k IN%@”,公司,arrayofcompaniesReference)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.