Reputation: 45
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
Reputation: 11174
from the NSFetchRequest
docs:
If you don’t specify a predicate, then all instances of the specified entity are selected
Upvotes: 1