Is there any common way to decompose an expression created by [NSPredicate predicateWithFormat] to objects NSComprasionPredicate, NSExpression and other?
For below example need to disassemble into components.
[NSPredicate predicateWithFormat:@"(0 != SUBQUERY(col开发者_如何学运维lection, $x, $x.name == "Name").@Count)"];
+[NSPredicate predicateWithFormat:] is actually the front-end for a rather sophisticated parser. If you introspect the resulting NSPredicate, you'll find that it's not actually an NSPredicate, but either an NSComparisonPredicate or an NSCompoundPredicate.
Both of those types of predicates have lots of handy methods for convenient introspection.
In other words: NSPredicate is actually an "abstract" class. You'll usually only ever deal with comparison or compound predicates. There are other kinds, such as NSBlockPredicate, but they're all undocumented.
加载中,请稍侯......
精彩评论