i have the following entity:
Contragents
with:
id (int64)
name (string)
city (string)
address (string)
I'm trying to fetch and display in the console all records, but i don't know how to work with predicate:
Contragents
with:
id (int64)
name (string)
city (string)
address (string)
I'm trying to fetch and display in the console all records, but i don't know how to work with predicate:
Code:
// fetch all Contragents
NSManagedObjectContext *moc = [[NSApp delegate] managedObjectContext];
NSEntityDescription *entityDescription = [NSEntityDescription
entityForName:@"Contragents" inManagedObjectContext:moc];
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:entityDescription];
//
NSPredicate *predicate = [NSPredicate predicateWithFormat:
@"(name)"];
[request setPredicate:predicate];
NSError *error;
NSArray *array = [moc executeFetchRequest:request error:&error];
if (array == nil)
{
NSLog(@"There is some error :(");
}
NSLog(@"array: %@", array);