Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSPredicate, NsNumber numberWithFloat:0.0 (iPhone)

hi i have Core Data database with numerical attributes. they are NSNumbers. Default value is 0.0 but when i try to do some NSPredicated fetch, i get "'NSInvalidArgumentException', reason: 'Invalid predicate: nil RHS'" just because attribute value is 0.0

The predicate is created with:

[NSPredicate predicateWithFormat:@"(startValue => %@) AND (endValue <= %@) AND (someId == %@)",startNSNumber,endNSNumber, idString]

how can i solve this problem ?

like image 535
Greg Avatar asked Sep 29 '10 16:09

Greg


1 Answers

You're adding the floats as objects, not as floats? Try this :

[NSPredicate predicateWithFormat:@"(startValue => %f) AND (endValue <= %f) AND (someId == %@)",startNSNumber,endNSNumber, idString];
like image 195
deanWombourne Avatar answered Sep 19 '22 02:09

deanWombourne