Core Data NSFetchRequest with predicate
Core Data NSFetchRequest with predicate
- Subject: Core Data NSFetchRequest with predicate
- From: "M. S. Hrishikesh" <email@hidden>
- Date: Fri, 02 Mar 2012 08:22:09 +0530
Hi
I have populated core data in my App with 10 entries. When I setup a fetch request with a predicate this way:
---
NSString *key = @"tag";
NSPredicate *pred = [NSPredicate predicateWithFormat:@"%K like %@",key,@"personality"];
[req setPredicate:pred];
NSArray *results = [self.managedObjectContext executeFetchRequest:req error:&error];
---
The array results has only 1 element. But all of my records have tag set to "personality" (without the quotes). In fact when I set the predicate to nil, fetch all records and print the tag I can see that all the tags are set to "personality".
Am I doing something wrong? How do I get all records with tag set to "personality"
Thanks
Hrishi
_______________________________________________
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