Reputation: 1983
I have created entity called Student in which we are storing student details.
I am trying to construct predicate to fetch few student details based on there ID's.
NSPredicate *predicate = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"Sid IN %@",@[@"1",@"2",@"3"]]];
Always getting error
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "Sid IN (
1,
2,
3
)"'
Upvotes: 0
Views: 52
Reputation: 539965
You should not (and in almost all cases there is no need to) mix stringWithFormat:
and
predicateWithFormat:
. In this case a simple
[NSPredicate predicateWithFormat:@"Sid IN %@", @[@"1",@"2",@"3"]]
should do.
Upvotes: 2