counting managed objects of a certain type
counting managed objects of a certain type
- Subject: counting managed objects of a certain type
- From: Daniel Child <email@hidden>
- Date: Wed, 09 Jul 2008 02:16:18 -0400
How do you determine how many managed objects of a certain entity type
exist in the managed object context?
Apple's sample code gives this example for finding managed objects.
NSManagedObjectContext *moc = [self managedObjectContext];
NSEntityDescription *entityDescription = [NSEntityDescription
entityForName:@"Employee" inManagedObjectContext:moc];
NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
[request setEntity:entityDescription];
....but then goes on to talk about various predicates (like "where
salary is over 10000").
I simply want "all employees".
I've looked through the documentation and found "countForFetchRequest:
error:"
but that still leads the question of what kind of request asks for
"all objects of a certain type".
Sorry if this is obvious. I'm new to Core Data and am still trying to
work through all the new classes.
Thanks.
_______________________________________________
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