Robbert Wolfs
Robbert Wolfs

Reputation: 45

Putting data from a core database in an array

I have a core data database and I would like to show the data into a tableview. I have been searching on the web how to do that but I never can find it.

NSEntityDescription *entitydesc = [NSEntityDescription entityForName:@"Host" inManagedObjectContext;context];
NSFetchRequest *request = [[NSFetchRequest alloc]init];
[request setEntity:entitydesc];

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"I DON'T KNOW WHAT TO PUT HERE"];
[request setPredicate:predicate];

But I have no idea what I have to write in the predicateWithFormat so I can select all the data of my database table.

And when I have all the data of my database table how can I put them in an array so i can add the array to a tableview?

Thanks :)

Upvotes: 1

Views: 103

Answers (1)

wattson12
wattson12

Reputation: 11174

from the NSFetchRequest docs:

If you don’t specify a predicate, then all instances of the specified entity are selected

Upvotes: 1

Related Questions