I’m working with this entity that has a timeStamp attribute that happens to be a Date type

Problem comes out, when I try to perform a search by date like:
NSDate *today = [NSDate date];
NSDate *end_day = [today dateByAddingTimeInterval: -5*one_day]; // the last 5 days
result = [helper fetchObjectsForEntityName:@"MyEntity" withPredicate:
[NSPredicate predicateWithFormat:@"timestamp > %f", [end_day ] ]];
When I print out the value of the predicate, all I get is something like:
timestamp > CAST(378132723.717909, "NSDate")
But when the statement gets executed, it crashes.
I use the same method in other parts of the code and it work with no problems, and
obviously if I remove the NSPredicate, again it works.
For the question’s sake here’s also the code for fetchObjectsForEnittyName: WithPredicate:
- (NSSet *)fetchObjectsForEntityName:(NSString *)newEntityName
withPredicate:(id)stringOrPredicate, ...
{
NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:newEntityName];
if (stringOrPredicate)
{
NSPredicate *predicate;
if ([stringOrPredicate isKindOfClass:[NSString class]])
{
va_list variadicArguments;
va_start(variadicArguments, stringOrPredicate);
predicate = [NSPredicate predicateWithFormat:stringOrPredicate
arguments:variadicArguments];
va_end(variadicArguments);
} else {
NSAssert2([stringOrPredicate isKindOfClass:[NSPredicate class]],
@"Second parameter passed to %s is of unexpected class %@",
sel_getName(_cmd), @"Whatevah");
predicate = (NSPredicate *)stringOrPredicate;
}
[request setPredicate:predicate];
}
NSError *error = nil;
NSArray *results = [self.managedObjectContext executeFetchRequest:request error:&error];
if (error != nil)
{
[NSException raise:NSGenericException format:[error description]];
}
return [NSSet setWithArray:results];
}
Does anyone have a clue about what the issue might be?
the complex the question seem the easiest the answer is.
i was using
without the capital S, like described in my entity!
so it should have been
case solved.