【发布时间】:2012-04-05 22:24:20
【问题描述】:
我在 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.
我设置了以下NSPredicate。
NSEntityDescription* entityDescription = [NSEntityDescription entityForName:@"Book" inManagedObjectContext:moc];
NSPredicate* predicate = [NSPredicate predicateWithFormat:@"isSync == 0 AND SUBQUERY(toBookOrders, $x, $x.toBook == SELF)"];
通过这个谓词,我只需要获取尚未同步的书籍及其相关顺序。
这是我收到的错误。
由于未捕获的异常而终止应用程序 'NSInvalidArgumentException',原因:'无法解析格式 字符串“isSync == 0 AND SUBQUERY(toBookOrders, $x, $x.toBook == SELF)”
有什么想法吗?提前谢谢你。
【问题讨论】:
标签: ios core-data nspredicate one-to-many