I set up the following model in Core Data.
Book has a to-many relationship, called toBookOrders, with OrderBook entity. The inverse is called toBook.
Book has a BOOL value property called isSync.
I set up the following NSPredicate
.
NSEntityDescription* entityDescription = [NSEntityDescription entityForName:@"Book" inManagedObjectContext:moc];
NSPredicate* predicate = [NSPredicate predicateWithFormat:@"isSync == 0 AND SUBQUERY(toBookOrders, $x, $x.toBook == SELF)"];
Through this predicate I need to grab only books that haven't been synchronized and theirs relative orders.
This is the error I receive.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "isSync == 0 AND SUBQUERY(toBookOrders, $x, $x.toBook == SELF)"
Any ideas? Thank you in advance.
See Question&Answers more detail:os