AKornich
AKornich

Reputation: 902

core data error: no known method '-notes'

My core data model has an entity with multiple attributes. Some of the attributes are integers, doubles and strings. When I fetch an instance of the entity from a data store (Sqlite), I get a valid object pointer and can get values of the numeric attributes, but when I try to get a value of an attribute that is string (for example, NSString *test = [fetchedObj notes]), I am getting following error:

error: no known method '-notes'; cast the message send to the method's return type

What is strange that the property for the attribute is defined/declared (I am using MOGenerator v1.26) and Xcode's code sense "sees" the property, but at runtime it is not known/visible at all. Also, I have other kinds of entities within the same model that have string attributes and they do work well. It seems the only one kind of entity causes the problem.

Any suggestions/hints on how to troubleshoot this issue?

Thank you in advance for help.

Upvotes: 1

Views: 266

Answers (1)

Tom Harrington
Tom Harrington

Reputation: 70966

Based on your description, you probably forgot to set the class name for the entity in the model editor, for just that class. As a result the objects are instances of NSManagedObject instead of your custom subclass, even if you've declared them they way you want them. Fix the class name for the entity and it should be OK.

Upvotes: 1

Related Questions