Usually when trying to create a
NSPredicate you would use a
NSDate. I'm trying to create a
NSPredicate from a unspecified class.
This is how I'm creating the predicate:
[NSPredicate predicateWithFormat:@"property == %@", value];
If value is a
NSString, this works fine, but if I create a
MyIdObjectand I set value to be a
MyIdObject I get slightly different predicates
These is the po result of the predicates I get:
NSString: property == "123"
MyIdObject: property == 123
Since the identifier is being saved as a
CoreData, this is enough to make the predicate fail.
I know the 123 is being returned from the description method.
Simply adding the needed " in the predicate format is not a solution because then I will just get property == "%@"
For some reason when the
NSString is returned from the
MyIdObject it is treated differently from just having a
NSString. Is there any solution for this?
Trying to simplify the question: I want to create a predicate using any
NSObject as the value and not a
NSString, although the value is saved as a
CoreData. Is that possible?