What does Unable to generate SQL for predicate (_STRING PREDICATE_) (problem on RHS) mean?

Viewed 7053

I'm trying to develop an app for iPhone using Core Data and I'm using a very basic predicate to grab objects. (i.e. attribute_name==string)

I've checked the model to make sure the attribute names are correct and I know from this SO question that RHS means "Right Hand Side," which leads me to the "string" part. I'm creating the format string using

NSString *predicateString = [NSString stringWithFormat:@"attribute_name==%@", string];

Then to fetch, I'm using this:

NSEntityDescription *entityDescription = [NSEntityDescription entityForName:_entityName inManagedObjectContext:managedObjectContext];
NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
[request setEntity:entityDescription];
NSPredicate *predicate = [NSPredicate predicateWithFormat:predicateString];
[request setPredicate:predicate];
NSError *error = nil;
NSArray *array = [managedObjectContext executeFetchRequest:request error:&error];

What am I missing? What could cause this error to occur?

Thanks.

2 Answers
Related