My predicate keeps on crashing my app with the message Unsupported function expression FUNCTION(SELF, \"filterDistanceWithLatitude:\" , latitude, longitude
). Do
A fetch request for a (SQL based) Core Data store cannot use Objective-C based predicates or sort descriptors. You can only filter on attributes stored in the data base.
Here is the relevant documentation from the "Core Data Programming Guide":
You cannot fetch using a predicate based on transient properties (although you can use transient properties to filter in memory yourself). ... To summarize, though, if you execute a fetch directly, you should typically not add Objective-C-based predicates or sort descriptors to the fetch request. Instead you should apply these to the results of the fetch.
There are some interactions between fetching and the type of store. ... The SQL store, on the other hand, compiles the predicate and sort descriptors to SQL and evaluates the result in the database itself. This is done primarily for performance, but it means that evaluation happens in a non-Cocoa environment, and so sort descriptors (or predicates) that rely on Cocoa cannot work.
'filterDistanceWithLatitude:' probably should be 'filterByDistanceWithLatitude:'