Re: NSPredicate and nil variables.
Re: NSPredicate and nil variables.
- Subject: Re: NSPredicate and nil variables.
- From: Óscar Morales Vivó <email@hidden>
- Date: Thu, 7 Jul 2005 00:06:14 -0400
Aha, so as I understand it since NSDictionary won't contain nil that
means it isn't possible to create a predicate with substitution
variables if any of them is nil.
I'm just a young padawan when it comes to Cocoa it seems. Should have
thought of that. :P
Anyway at least I know now exactly how it behaves (and it also means
I'll have to do a lot of checking for nil in my code)
Thanks for the insight.
Oscar Morales Vivo.
On Jul 6, 2005, at 23:14 , mmalcolm crawford wrote:
On Jul 6, 2005, at 5:19 PM, Óscar Morales Vivó wrote:
I've understood how to build predicates with variables, how to
instantiate them and do fetch requests on them. However I'm not
sure how the predicate will behave if any of the predicate's
variables ends up being nil, especially for things like dates
where I'm not sure how a zero would be interpreted.
Do you mean you want to use predicateWithSubstitutionVariables?
<http://developer.apple.com/documentation/Cocoa/Conceptual/
Predicates/Articles/pCreating.html#//apple_ref/doc/uid/
TP40001793-219639-BCIIHDCH>
"To create a valid predicate to evaluate against an object, you use
the NSPredicate method predicateWithSubstitutionVariables: to pass
in a dictionary that contains the variables to be substituted.
(Note that the dictionary must contain key-value pairs for all the
variables specified in the predicate.)"
(That constraint should be mentioned in the API reference...)
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden