views:

20

answers:

1

Is that true? Or could I fetch multiple entities at once? If so, how would that look like?

(Guess: No. NSFetchRequest asks for one and only one entity)

+1  A: 
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"MyEntities" inManagedObjectContext:[self context]];
[request setEntity:entity]; 

There is the request set up, calling:

NSMutableArray *mutableFetchResults = [[[[self context] executeFetchRequest:request error:&error] mutableCopy] autorelease];

Will return an array of all my MyEntities persistet by Core Data.

You can pass the request sortDescriptors or predicates to filter and sort the return values, but the value is always an array.

It is a bit tricky, but extremely useful.

RickiG
So in the end, the answer is: Yes
dontWatchMyProfile
Yes:) I seldom retrieve just one Entity. It is usually several and almost always sorted by a property on the entity.
RickiG