Yeah, so I’ve been learning Core Data and I keep getting this error during a fetch request:
Name: NSInvalidArgumentException
File: Unknown
Line: Unknown
Reason: Unsupported expression type (11, SIZE)
An obscure error message, yay! This happened when I used this very simple predicate declaration:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"size == %@", @"medium"];
Like one of those bad days, Google doesn’t help. It took me an hour or two to figure out that size
is a reserved word in Core Data. Epic fail. You can fix this by escaping size
using a hash (#
):
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"#size == %@", @"medium"];