我们正在尝试编写一个Realm查询来检索RLMArray属性大小为某个数字的所有对象。 Realm模型如下所示:
class Foo: RLMObject {
dynamic var people = RLMArray(objectClassName: User.className())
}
我们尝试过但没有成功的查询的多次迭代如下:
// 'Invalid predicate expressions', reason: 'Predicate expressions must compare a keypath and another keypath or a constant value'
let results = Foo.objectsWhere("people[SIZE] = %d", 2)
// 'Invalid predicate', reason: 'RLMArray predicates must contain the ANY modifier'
let results = Foo.objectsWhere("people.@count = %d", 2)
// 'Invalid column name', reason: 'Column name @count not found in table'
let results = Foo.objectsWhere("ANY people.@count = %d", 2)
我们已经看了很多例子,Apple的NSPredicate& amp;其他SO答案,我们似乎无法找到答案。我们如何根据RLMArray属性的大小查询所有对象?