A: 

Your problem isn't the predicate; your problem is that you're dealing with NSString objects instead of dealing with NSNumber objects. I would focus my time on changing them to NSNumbers first, and then verify that it's not working.

FYI, the JSON Framework does automatic parsing of numbers into NSNumbers...

Dave DeLong
Hi Dave, thank you, yes I would also prefer to deal with the correct types:)I looked at the JSON library I am using, it does scan for numbers. Then I tried this: BOOL theBool = [[dict objectForKey:@"distanceInMeters"] isKindOfClass:[NSString class]]; NSLog(@"The value of the bool is %@\n", (theBool ? @"YES" : @"NO"));It comes back YES, so no doubt. I am using SBJSON could it be that it is simply no working?
RickiG
+3  A: 

Try this:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(distanceInMeters.floatValue <= %f)", newValue];
BJ Homer
Hi HomerThanks that did the trick:) I did not know that you could type cast like that, NSPredicates on anything else that NSManagedObjects is new to me:)Thanks again
RickiG
FYI, it's not type-casting; it's just calling the "floatValue" method on NSString.
BJ Homer
Ahh Thanks I get it, it is of course accessing the property directly instead of the accessor [NSString floatValue]:)
RickiG
No, it's calling the accessor. NSString doesn't have a "floatValue" property to access directly. And in general, NSPredicates access things using the valueForKey: method for each dot-separated component. valueForKey: uses an accessor if available, or direct access to the ivar of not. Just because the predicate syntax uses a dot doesn't mean that it's using properties. And even if it were, if NSString had a "floatValue" property, accessing it would be IDENTICAL to calling [thatString floatValue].
BJ Homer