Re: Core Data NSFetchRequest with predicate
Re: Core Data NSFetchRequest with predicate
- Subject: Re: Core Data NSFetchRequest with predicate
- From: Jerry Krinock <email@hidden>
- Date: Thu, 01 Mar 2012 22:08:33 -0800
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 (email@hidden)
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:
This email sent to email@hidden