Teerasej
Teerasej

Reputation: 1536

How to fetch only first entity from Core data?

It may looks like a newbie question, but I really am. I try to fetch only first object from Core data. But I try to figure out how could I done this?

For example, it may have 100 object in Core data for specific entity. I just need the first one. Could you give me your advice?

Upvotes: 1

Views: 398

Answers (1)

diciu
diciu

Reputation: 29333

See Fetch limits

NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
[request setFetchLimit:1];

Upvotes: 3

Related Questions