Vote count:
0
We're trying to write a Realm query to retrieve all objects where the size of a RLMArray property is a certain number. The Realm model looks like this:
class Foo: RLMObject {
dynamic var people = RLMArray(objectClassName: User.className())
}
And multiple iterations of the query we've tried without success are as follows:
// '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)
We've looked through multiple examples, Apple's docs on NSPredicate & other SO answers, and we can't seem to find an answer. How do we query for all objects based on the size of a RLMArray property?
asked 30 secs ago
Query Realm for all objects based on the size of a RLMArray property?
Aucun commentaire:
Enregistrer un commentaire