I used the NSPredictate Class, but the following error has occurred.
I Can’t know the reason.
Why does occur following error?

Follow is source code.
#import "Predictate.h"
@implementation Predictate
@synthesize dictate;
-(id)init{
if ((self = [super init])) {
}
return self;
}
- (void)Predictate{
dictate = [[NSMutableArray alloc]initWithObjects:@"AAA",@"BBB",@"CCC", nil];
NSPredicate *test = [NSPredicate predicateWithFormat:@"dictate like 'AAA'"];
NSMutableArray *result = [dictate filteredArrayUsingPredicate:test];
NSLog(@"%@",result);
}
-(void)dealloc{
[dictate release];
[super dealloc];
}
@end
Error message is below.
2012-01-02 00:57:39.972 filter[1750:707] *** Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: ‘[<__NSCFConstantString 0x100002290> valueForUndefinedKey:]: this class is not key value coding-compliant for the key dictate.’
You’re using
NSPredicateto filter an array of string objects, but are usingdictate like 'AAA'. The predicate will have absolutely no idea what thisdictatemeans.You will want to replace
dictatewithSELF, so that it becomes"SELF like 'AAA'"