NSPredicate 'El lado izquierdo para un operador ALL o ANY debe ser NSArray o NSSet'
Frecuentes
Visto 6,187 veces
5
Not totally sure why this isn't working now, i thought it had been working previously. Does anyone see an issue with this FetchRequest construction?
- (NSArray *)entriesForDate:(NSDate *)date {
NSFetchRequest *request = [[NSFetchRequest alloc]initWithEntityName:@"Entry"];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY addedOn.unique like %@", [T3Utility identifierForDate:date]];
request.predicate = predicate;
NSError *error = nil;
NSArray *matches = [self.database.managedObjectContext executeFetchRequest:request error:&error];
return matches;
}
Again, i'm 99% sure that this code has been working until recently, so im thinking perhaps there's something else going on in my code somewhere . . .but when i run it through the debugger this is where is hangs. Here is my error:
The left hand side for an ALL or ANY operator must be either an NSArray or NSSet
¿Alguna idea?
gracias!
1 Respuestas
8
Parece addedOn
is not a to-many relationship. Make sure you use the correct names of your attributes / relationships in the predicate. Also, note that you cannot use a to-one relationship in a "ANY" predicate.
Respondido 26 ago 12, 08:08
+1 specifically, either addedOn
needs to be to-many, with unique
being a property (or to-one relationship), or addedOn
needs to be to-one and unique
needs to be a to-many relationship. - Dave DeLong
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas ios xcode core-data nspredicate nsfetchrequest or haz tu propia pregunta.
What are the attributes and relationships of your entities? - Martin R