Reputation: 16268
I'm trying to use the following predicate:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ending_date < date('now')", nil];
But I'm getting NSInvalidArgumentException', reason: 'Unable to parse function name 'date:' into supported selector (date:) '
so I guess maybe the date('now')
is not supported on iOS version of SQLite
how can I accomplish it?
Upvotes: 0
Views: 744
Reputation: 678
You should use the NSExpression now instead of date:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ending_date < now", nil];
Upvotes: 0
Reputation: 3791
You could try this...
NSDate *dateNow = [NSDate date];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ending_date < %@", dateNow];
Upvotes: 1