I'm successfully using Core Data in my project and have code that looks like this to control an icon state:
-(BOOL)messageItemEnabled;
{
// If there are items in the message queue, it's enabled
NSSet *messageSet = [moc fetchObjectsForEntityName:@"Message" withPredicate:nil];
return [messageSet count] > 0;
}
All I really need to know in this case is whether any Message entity exists, not get all of them. Is there a way to do this?
I have seen [request setFetchLimit:1]; but the docs are contradictory as to whether this exists, and unclear as to which stores it works with.