I have the following code:
NSString *mapIDx = @"98";
NSLog(@"map id: %@", mapIDx);
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"WayPoint" inManagedObjectContext:managedObjectContext];
[request setEntity:entity];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"waypoint_map_id==%@", mapIDx];
[request setPredicate:predicate];
NSError *error;
listArray = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];
[request release];
int arrayItemQuantity = [listArray count];
NSLog(@"Array Quantity: %d", arrayItemQuantity);
int i;
for (i = 0; i < arrayItemQuantity; i++)
{
NSLog (@"Element %i = %@", i, [listArray objectAtIndex: i]);
}
[listArray release];
As you can see, I am trying to select specific objects from my database, anything with waypoint_map_id from 98, but NSPredicate does not work as I expected. Zero objects are selected.
Any thoughts?
source
share