On 2012 Mar 01, at 18:52, M. S. Hrishikesh wrote:

> NSString *key = @"tag";
> NSPredicate *pred = [NSPredicate predicateWithFormat:@"%K like 
> %@",key,@"personality"];

Well, what you're doing looks OK to me, but I'm not sure because I don't often 
use +predicateWithFormat:.  Since you're apparently spending a lot of time on 
this, see what happens if you use this method instead:

   +[NSComparisonPredicate predicateWithLeftExpression:
                                       rightExpression:
                                              modifier:
                                                  type:
                                               options:]

Yes it's more lines of code, but it might give you a different result and give 
you a clue.

And, for me, it would be time well spent because I'm not enough of an artist to 
use -predicateWithFormat: in a shipping product.  There are just too many ways 
to introduce bugs.  Write yourself some wrappers around NSComparisonPredicate 
methods for commonly-used predicate structures.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to