I have two classes, Company and MyCompany. MyCompany is a subclass of Company, and Company is a subclass of NSManagedObject. I am trying to write a predicate for an NSFetchRequest that will return results of the class Company, but filter out MyCompany objects.
I have tried the following (suggested from here https://stackoverflow.com/a/8065935/472344):
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"class != %@",NSStringFromClass([myCompany class])];
But I get an error:
'keypath class not found in entity <NSSQLEntity CKCompany id=1>'
I also tried (suggested from here https://stackoverflow.com/a/11693983/472344, I know I really want not SELF isKindOfClass, but I was just testing with the exact same command as given in the answer):
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self isKindOfClass: %@", [myCompany class];
And got the following error:
'Unknown/unsupported comparison predicate operator type'
How can I write a predicate to achieve what I want? I am supporting iOS 5 and above.